Skip to content

Instantly share code, notes, and snippets.

@HJulio
Created November 19, 2015 14:26
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 HJulio/89a922b7b7bcb6002196 to your computer and use it in GitHub Desktop.
Save HJulio/89a922b7b7bcb6002196 to your computer and use it in GitHub Desktop.
Python passwords generator
def random_password(length=8):
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