Skip to content

Instantly share code, notes, and snippets.

@013231
Created May 3, 2012 19:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 013231/2588521 to your computer and use it in GitHub Desktop.
Save 013231/2588521 to your computer and use it in GitHub Desktop.
Generate similar names.
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