+ -
当前位置:首页 → 问答吧 → python3.2中unicode方法不见了

python3.2中unicode方法不见了

时间:2011-04-06

来源:互联网

本帖最后由 yakczh 于 2011-04-06 08:03 编辑

这是字符串的方法  
---------- python32 ----------
__add__
__class__
__contains__
__delattr__
__doc__
__eq__
__format__
__ge__
__getattribute__
__getitem__
__getnewargs__
__gt__
__hash__
__init__
__iter__
__le__
__len__
__lt__
__mod__
__mul__
__ne__
__new__
__reduce__
__reduce_ex__
__repr__
__rmod__
__rmul__
__setattr__
__sizeof__
__str__
__subclasshook__
capitalize
center
count
encode
endswith
expandtabs
find
format
format_map
index
isalnum
isalpha
isdecimal
isdigit
isidentifier
islower
isnumeric
isprintable
isspace
istitle
isupper
join
ljust
lower
lstrip
maketrans
partition
replace
rfind
rindex
rjust
rpartition
rsplit
rstrip
split
splitlines
startswith
strip
swapcase
title
translate
upper

unicode(str,"xx")  也不能用了

不论是# -*- coding=gbk -*-  还是 # -*-  coding=utf8 -*-  
s="中文"
都是4e2d 6587
s=u"中文" 这样写直接报错
SyntaxError: invalid syntax

作者: yakczh   发布时间: 2011-04-06

python3里面的str就是2里面的unicode

作者: Kabie   发布时间: 2011-04-06