Yeb*_*ach 20 python unicode lowercase python-2.7 python-unicode
当我.lower()
在Python 2.7中使用时,字符串不会转换为小写字母Š?Ž
.我从字典中读取数据.
我试过用str(tt["code"]).lower()
,tt["code"].lower()
.
有什么建议 ?
CR *_*ost 25
使用unicode字符串:
drostie@signy:~$ python
Python 2.7.2+ (default, Oct 4 2011, 20:06:09)
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print "Š?Ž"
Š?Ž
>>> print "Š?Ž".lower()
Š?Ž
>>> print u"Š?Ž".lower()
š?ž
Run Code Online (Sandbox Code Playgroud)
看到那个小u
?这意味着它被创建为unicode
对象而不是str
对象.
归档时间: |
|
查看次数: |
24915 次 |
最近记录: |