password gen python code example
Example 1: password generator python
import string
from random import *
characters = string.ascii_letters + string.punctuation + string.digits
password = "".join(choice(characters) for x in range(randint(8, 16)))
print password
Example 2: python password generator
import random
import string
x = str(input("Do you want a password? y/n "))
list = []
if x == "y":
print("Alright!")
for i in range(16):
_1 = random.choice(string.ascii_letters)
_2 = random.randint(1, 9)
list.append(_1)
list.append(_2)
else:
print("ok")
def convert(list):
s = [str(i) for i in list]
res = "".join(s)
return(print(res))
convert(list)