python generate random password string code example
Example 1: python random password generator
import random
alph = list('ABCDEFGHIJKLMNOPQRSTUVWXYZ\
abcdefghijklmnopqrstuvwxyz\
1234567890 !@#$%^&*(){}[]<>,.')
out = ''
for char in string:
out += random.choice(alph)
print(out)
Example 2: python random string for password generator
''.join(random.SystemRandom().choice(string.ascii_uppercase + string.digits) for _ in range(N))