>>dir(str)[ __add__ , __class__ , __contains__ , __delattr__ , __doc__ , __eq__ ,format__ , __ge__ , __getattribute__ , __getitem__ , __getnew..."/>
您好,登錄后才能下訂單哦!
>>>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'
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。