Guest User

Untitled

a guest
Oct 21st, 2017
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. import string
  2. from itertools import combinations, product
  3.  
  4. alphabet = string.ascii_lowercase
  5. max_length = 5
  6. file_ = open("combos.txt","w")
  7.  
  8. def combos(chars=alphabet, max_len=max_length):
  9. for length in xrange(5, max_length + 1):
  10. for combo in map(''.join, product(alphabet, repeat=length)):
  11. yield combo
  12.  
  13. for combo in combos():
  14. file_.write(combo + '\n')
  15. file_.close
  16. print(combo)
Add Comment
Please, Sign In to add comment