python (如何产生特殊字符), 就像string.letters一样直接产生大小写的全部字母, 有没有一个这种方法能直

产生所有的特殊字符,包括~!#@¥%……&*()——+|。?等

第1个回答  2012-04-07
>>> import string
>>> string.printable
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ \t
\n\r\x0b\x0c'
>>>
第2个回答  2011-03-30
试试itertools模块
第3个回答  2011-04-02
这个简单
string.punctuation

参考资料:http://docs.python.org/library/string.html

相似回答