Python Password Generator


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

A simple python password generator...


Copy this code and paste it in your HTML
  1. import random
  2.  
  3. def main():
  4. while True:
  5. stop = input("Generate password? y/n: ")
  6. if stop and stop[0].lower() == "n":
  7. break
  8.  
  9. length = int
  10.  
  11. size = input("What length do you want the password to be(4-20): ")
  12. length = int(size)
  13.  
  14. chars = string.ascii_letters + string.digits
  15. return ''.join(random.choice(chars) for x in range(length))

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.