bobhig

Password generator

Jan 30th, 2019
62
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #random password generator
  2.  
  3. import string
  4. from random import choice
  5.  
  6. characters = list(string.printable)
  7. #not sure about the last 2 characters and some of the others so might need
  8. #to use other strings from the library and join.
  9.  
  10.  
  11. def generate_password(len):
  12.  
  13.     password = ""
  14.  
  15.     for i in range(len):
  16.         char = choice(characters)
  17.         password += char
  18.    
  19.     return password
  20.  
  21. print(generate_password(7))
RAW Paste Data