码迷,mamicode.com
首页 > 其他好文 > 详细

String constants 应用

时间:2015-07-31 14:29:07      阅读:117      评论:0      收藏:0      [点我收藏+]

标签:

 

技术分享

技术分享技术分享

>>> import string
>>> string.ascii_letters
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
>>> string.ascii_lowercase
abcdefghijklmnopqrstuvwxyz
>>> string.ascii_uppercase
ABCDEFGHIJKLMNOPQRSTUVWXYZ
>>> string.digits
0123456789
>>> string.hexdigits
0123456789abcdefABCDEF
>>> string.letters
Traceback (most recent call last):
  File "<pyshell#98>", line 1, in <module>
    string.letters
AttributeError: module object has no attribute letters
>>> string.octdigits
01234567
>>> string.punctuation
!"#$%&\‘()*+,-./:;<=>?@[\\]^_`{|}~
>>> #punctuation[英][?p??kt?u?e??n][美][?p??kt?u?e??n]
n.标点符号
Traceback (most recent call last):
  File "<pyshell#101>", line 2, in <module>
    n.标点符号
NameError: name n is not defined
>>> string.printable
0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\‘()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\x0b\x0c
>>> string.whitespace
 \t\n\r\x0b\x0c

 

String constants 应用

标签:

原文地址:http://www.cnblogs.com/hhj187/p/4692000.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!