属性 |
含义 |
string.ascii_letters |
输出所有字母的字符串 |
string.ascii_lowercase |
输出所有小写字母的字符串 |
string.ascii_uppercase |
输出所有大写字母的字符串 |
string.letters |
同string.ascii_letters(大小写前后可能有别) |
string.lowercase |
同string.ascii_lowercase |
string.uppercase |
同string.ascii_uppercase |
string.octdigits |
输出所有8进制数字字符串 |
string.hexdigits |
输出所有16进制数字字符串 |
string.digits |
输出所有数字的字符串 |
string.punctuation |
输出所有标点符号的字符串 |
string.whitespace |
输出所有空白符号的字符串 |
In [1]: import string
In [2]: string.ascii_letters
Out[2]: 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
In [3]: string.ascii_lowercase
Out[3]: 'abcdefghijklmnopqrstuvwxyz'
In [4]: string.ascii_uppercase
Out[4]: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
In [5]: string.letters
Out[5]: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
In [6]: string.lowercase
Out[6]: 'abcdefghijklmnopqrstuvwxyz'
In [7]: string.uppercase
Out[7]: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
In [8]: string.octdigits
Out[8]: '01234567'
In [9]: string.hexdigits
Out[9]: '0123456789abcdefABCDEF'
In [10]: string.digits
Out[10]: '0123456789'
In [11]: string.punctuation
Out[11]: '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'
In [12]: string.whitespace
Out[12]: '\t\n\x0b\x0c\r '