Skip to content

Instantly share code, notes, and snippets.

@milnomada
Last active May 20, 2018 01:51
Show Gist options
  • Save milnomada/0e40a0c55a32a5249abeddfdb366f7f7 to your computer and use it in GitHub Desktop.
Save milnomada/0e40a0c55a32a5249abeddfdb366f7f7 to your computer and use it in GitHub Desktop.
Python password generator
import sys,random
size=8
if len(sys.argv)>1:
try:
size=int(sys.argv[1])
except ValueError:
pass
charset="!?#$%&*()_abcdefghijklmnopqrstuvwxyz01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ"
print("".join(random.sample(charset,size)))
# run: python ge.py 16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment