Skip to content

Instantly share code, notes, and snippets.

@timkofu
Created April 16, 2019 09:49
Show Gist options
  • Save timkofu/a0178f5ec9c6b7829612f404deb3dc03 to your computer and use it in GitHub Desktop.
Save timkofu/a0178f5ec9c6b7829612f404deb3dc03 to your computer and use it in GitHub Desktop.
Random password generator
#!/usr/bin/env python
import random
import string
def generate_random_password():
""" Generate 21 character random password """
selection = string.ascii_letters + string.digits + "#$%&@"
rand_pass = ""
password_length = 21
while password_length > 0:
rand_pass += random.choice(selection)
password_length -= 1
return rand_pass
if __name__ == "__main__":
print(generate_random_password())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment