Skip to content

Instantly share code, notes, and snippets.

@jigi-33
Created November 21, 2020 14:19
Show Gist options
  • Select an option

  • Save jigi-33/f661f8769d7112cafe39859a0d8b12c4 to your computer and use it in GitHub Desktop.

Select an option

Save jigi-33/f661f8769d7112cafe39859a0d8b12c4 to your computer and use it in GitHub Desktop.
pretty password generator (py3)

pretty password generator on python

# -*- coding: utf-8 -*-
# code borrowed from the n05tr0m0's gist

import random
from string import ascii_letters, digits, punctuation


def gen_pwd(len_pas, spec_symbols=False):
    symbols = ascii_letters + digits
    if spec_symbols:
        symbols = symbols + punctuation
    secure_random = random.SystemRandom()
    pwd = ''.join(secure_random.choice(symbols) for sym in range(len_pas))
    return pwd


if __name__ == '__main__':
    print(gen_pwd(12, spec_symbols=True))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment