Skip to content

Instantly share code, notes, and snippets.

Created December 31, 2015 16:35
Show Gist options
  • Save anonymous/4a752288b785312ca840 to your computer and use it in GitHub Desktop.
Save anonymous/4a752288b785312ca840 to your computer and use it in GitHub Desktop.
import string
import random
def pw_gen(size = 8, chars=string.ascii_letters + string.digits + string.punctuation):
return ''.join(random.choice(chars) for _ in range(size))
print(pw_gen(int(input('How many characters in your password?'))))
@master-stm
Copy link

hi, can i get some explanation for the function above ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment