Posted By

allistera on 06/27/10


Tagged

password method random allistera


Versions (?)

Generate Random Password


 / Published in: Python
 

Example Usage:
print generatePassword(length = 20, using = "10")
print generatePassword(length = 8)
print generatePassword()
Output:
01011110010011000100

z&v^9?dx

+=z?=)vene
  1. def generatePassword(length = 10, using = "123456789qwertyuioplkjhgfdsazxcvbnm!£$%^&*()_+-=:@?><"):
  2. random.seed()
  3. password = ""
  4. for i in range(0, length):
  5. password = password + using[random.randrange(0, len(using))]
  6. return password

Report this snippet  

You need to login to post a comment.