Skip to content

Instantly share code, notes, and snippets.

@juanmhidalgo
Created March 9, 2016 14:15
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 juanmhidalgo/c4132bedb25397c2cfff to your computer and use it in GitHub Desktop.
Save juanmhidalgo/c4132bedb25397c2cfff to your computer and use it in GitHub Desktop.
Password Generator
import os
import string
def random_password(length=10):
chars = string.ascii_uppercase + string.digits + string.ascii_lowercase
password = ''
for i in range(length):
password += chars[ord(os.urandom(1)) % len(chars)]
return password
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment