Python/other/password_generator.py

16 lines
511 B
Python
Raw Normal View History

from __future__ import print_function
2016-08-14 06:48:30 +00:00
import string
import random
2016-08-14 06:48:30 +00:00
letters = [letter for letter in string.ascii_letters]
digits = [digit for digit in string.digits]
symbols = [symbol for symbol in string.punctuation]
2016-08-14 06:48:30 +00:00
chars = letters + digits + symbols
random.shuffle(chars)
2016-08-14 06:48:30 +00:00
min_length = 8
max_length = 16
password = ''.join(random.choice(chars) for x in range(random.randint(min_length, max_length)))
print('Password: ' + password)
2016-08-14 06:48:30 +00:00
print('[ If you are thinking of using this passsword, You better save it. ]')