有没有包含所有ascii字符列表的Python库? [英] Is there a Python Library that contains a list of all the ascii characters?
本文介绍了有没有包含所有ascii字符列表的Python库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
类似以下内容:
import ascii
print ascii.charlist()
哪个会返回类似[A,B,C,D ...]
Which would return something like [A, B, C, D...]
推荐答案
string
常量可能就是您想要的. (文档)
The string
constants may be what you want. (docs)
>>> import string
>>> string.ascii_uppercase
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
如果您希望所有可打印的字符:
If you want all printable characters:
>>> string.printable
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;?@[\\]^_`{|}~ \t\n\r\x0b\x0c'
这篇关于有没有包含所有ascii字符列表的Python库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文