Skip to content

Instantly share code, notes, and snippets.

@rahulrajaram
Last active October 23, 2017 02:30
Show Gist options
  • Save rahulrajaram/1479f4f017e2ca752f1f45cdb878b3d2 to your computer and use it in GitHub Desktop.
Save rahulrajaram/1479f4f017e2ca752f1f45cdb878b3d2 to your computer and use it in GitHub Desktop.
Password generator using Python
import random
import string

# The pool of characters to pick the characters for your password from
password_char_set = string.ascii_letters + string.digits + string.punctuation

def random_character():
    return password_char_set[random.randint(0, len(password_char_set))]


password_length = 12
print(''.join([random_character() for i in range(0, password_length + 1)]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment