Cos*_*Inc 24 python python-3.x
在Python 2中你得到了
>>> from string import *
>>> letters
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
Run Code Online (Sandbox Code Playgroud)
但是在Python 3中,你得到了
>>> from string import *
>>> letters
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'letters' is not defined
Run Code Online (Sandbox Code Playgroud)
它没有定义,而是digits
和whitespace
.
letters
Python 3中字符串模块的等价性是什么?
sum*_*mea 40
尝试使用:string.ascii_letters
而不仅仅是letters
,在这里.
更多信息请访问:http://docs.python.org/release/3.1.3/library/string.html#string-constants
归档时间: |
|
查看次数: |
10666 次 |
最近记录: |