Python中的字符串方法

方法名 使用方法 解釋
center astring.center(w) 返回一個字符串, w 長度,原字符串居中
count astring.count(item) 返回原字符串中出現item 的次數
ljust astring.ljust(w) 返回一個字符串, w 長度,原字符串居左
lower astring.lower() 返回一個字符串,全部小寫
rjust astring.rjust(w) 返回一個字符串, w 長度,原字符串居右
find astring.find(item) 查詢item,返回第一個匹配的索引位置
split astring.split(schar) 以schar 爲分隔符,將原字符串分割,返回一個
列表

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章