strip用法
Python strip() 方法用于移除字符串頭尾指定的字符(默認(rèn)為空格或換行符)或字符序列。
注意:該方法只能刪除開頭或是結(jié)尾的字符,不能刪除中間部分的字符。
?
str = "00000003210Runoob01230000000"; print str.strip( '0' ); # 去除首尾字符 0
str2 = " Runoob "; # 去除首尾空格 print str2.strip();
轉(zhuǎn)載于:https://www.cnblogs.com/heris/p/11200534.html
總結(jié)
- 上一篇: Android 创建,验证和删除桌面快捷
- 下一篇: DataFrame.to_dict(or