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