您好,登录后才能下订单哦!
>>>dir(str)
['__add__','__class__', '__contains__', '__delattr__', '__doc__', '__eq__',
format__','__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__
slice__','__gt__', '__hash__', '__init__', '__le__', '__len__', '__lt__', '_
d__', '__mul__','__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr_
'__rmod__', '__rmul__', '__setattr__','__sizeof__', '__str__', '__subclassh
__','_formatter_field_name_split', '_formatter_parser', 'capitalize', 'cente
'count', 'decode', 'encode', 'endswith','expandtabs', 'find', 'format', 'in
', 'isalnum','isalpha', 'isdigit', 'islower', 'isspace', 'istitle', 'isupper
'join', 'ljust','lower', 'lstrip', 'partition', 'replace', 'rfind', 'rindex'
rjust','rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith'
strip','swapcase', 'title', 'translate', 'upper', 'zfill']
>>> name= "dick"
>>>name.capitalize()
'Dick'
>>>name.center(20)
' dick '
>>>name.center(20,'**')
'********dick********'
>>> name
'dick'
>>>name[0:1]
'd'
>>> name= 'hdwquhnjdoiwqjdwqdiuewmdpoewkdpwqdkkmwqpodwq'
>>>name.count('s')
0
>>>name.count('w')
8
>>>name.count('w',0,10)
1
>>> name= 'alax'
>>>name[0:2]
'al'
>>>name.count('a',0,2)
1
>>>
>>> '胡伟'
'\xba\xfa\xce\xb0'
>>> str1= '\xba\xfa\xce\xb0'
>>>print str1
胡伟
>>>str1.decode('gbk')
u'\u80e1\u4f1f'
>>>str1.decode('gbk').encode('utf-8')
'\xe8\x83\xa1\xe4\xbc\x9f'
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。