源码解释:
"""A collection of string constants.
Public module variables:
whitespace -- a string containing all ASCII whitespace
ascii_lowercase -- a string containing all ASCII lowercase letters
ascii_uppercase -- a string containing all ASCII uppercase letters
ascii_letters -- a string containing all ASCII letters
digits -- a string containing all ASCII decimal digits
hexdigits -- a string containing all ASCII hexadecimal digits
octdigits -- a string containing all ASCII octal digits
punctuation -- a string containing all ASCII punctuation characters
printable -- a string containing all ASCII characters considered printable
"""
示例代码:
import string
aa = string.ascii_letters
print(aa)
bb = string.ascii_lowercase
print(bb)
cc = string.ascii_uppercase
print(cc)
dd = string.hexdigits
print(dd)
ee = string.printable
print(ee)
运行结果:
更多用法详见源码...