import random import string print(string.ascii_letters) # 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' print(string.ascii_lowercase) # 'abcdefghijklmnopqrstuvwxyz' print(string.ascii_uppercase) # 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' print(string.digits) # '0123456789' print(string.hexdigits) # '0123456789abcdefABCDEF' print(string.octdigits) # '01234567' print(string.printable) # '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ # !"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\x0b\x0c' print(string.punctuation) # '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~' print(string.whitespace) # '\t\n\x0b\x0c\r ' print("".join(random.choice(string.printable) for x in range(10))) # zrZqU~?e}M print("".join(random.sample(string.ascii_letters, 5))) # sBvLt print("".join(random.sample(string.ascii_letters + string.digits, 8))) # s5T30DY9