nep*_*pwk 5 python string unicode strip
如何在unicode字符串上使用strip()等字符串方法?并且你不能访问像oridnary字符串一样的unicode字符串的字符?(例如:mystring [0:4])
Gab*_*aru 8
它正常工作,只要它们实际上unicode不是str(注意:每个字符串文字都必须在前面u,如本例所示):
unicode
str
u
>>> a = u"co?ofan?" >>> a u'co\u021bofan\u0103' >>> a[-1] u'\u0103' >>> a[2] u'\u021b' >>> a[3] u'o' >>> a.strip(u'?') u'co\u021bofan'
归档时间:
14 年,4 月 前
查看次数:
34923 次
最近记录:
9 年,5 月 前