Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import string
- from itertools import combinations, product
- alphabet = string.ascii_lowercase
- max_length = 5
- file_ = open("combos.txt","w")
- def combos(chars=alphabet, max_len=max_length):
- for length in xrange(5, max_length + 1):
- for combo in map(''.join, combinations(alphabet, length)):
- yield combo
- for combo in combos():
- print combo
- file_.write(combo)
- file_.close
Add Comment
Please, Sign In to add comment