Skip to content

Instantly share code, notes, and snippets.

@gavintranquilino
Created February 26, 2024 22:22
Show Gist options
  • Save gavintranquilino/978b12e91c397eced2ca0e0fa636e3e9 to your computer and use it in GitHub Desktop.
Save gavintranquilino/978b12e91c397eced2ca0e0fa636e3e9 to your computer and use it in GitHub Desktop.
Generate an list of n letter permutations of string of characters and save to a txt file in Python
from itertools import product
alphabet = "abcdefghijklmnopqrstuvwxyz"
usernames = ["".join(i) for i in product(alphabet, repeat=6)]
with open("myusernameisthis.txt", "w") as f:
for username in usernames:
f.write(username + "\n")
print("I'm Done")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment