Generate Random Password


/ Published in: Python
Save to your folder(s)

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

z&v^9?dx

+=z?=)vene


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.