In [8]: import string
In [9]: dir(string)
In [10]: string.ascii_letters
Out[10]: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
In [11]: string.ascii_lowercase
Out[11]: 'abcdefghijklmnopqrstuvwxyz'
In [12]: string.ascii_uppercase
Out[12]: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
In [13]: string.digits
Out[13]: '0123456789'
In [14]: string.punctuation
Out[14]: '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'
In [15]: string.whitespace
Out[15]: '\t\n\x0b\x0c\r '
来源:https://www.cnblogs.com/my8100/p/7068512.html