Run
import random import string N = 20 #password length #allowed string constants allowedChars = string.ascii_letters + string.digits + string.punctuation #genereate password password = ''.join(random.choice(allowedChars) for _ in range(N)) print(password)
Output