Created
May 3, 2012 19:33
-
-
Save 013231/2588521 to your computer and use it in GitHub Desktop.
Generate similar names.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import itertools | |
def simNames(name): | |
elements = [] | |
for ch in name: | |
if ch == '0' or ch == 'o': | |
elements.append(['0', 'o']) | |
elif ch == '1' or ch == 'i' or ch == 'l': | |
elements.append(['1', 'i', 'l']) | |
else: | |
elements.append([ch]) | |
return [''.join(chars) for chars in itertools.product(*elements)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment