码迷,mamicode.com
首页 > 编程语言 > 详细

python学习之strip()

时间:2017-10-12 17:08:54      阅读:172      评论:0      收藏:0      [点我收藏+]

标签:family   amp   str   sof   指定   log   ros   移除   sharp   

定义:

Python strip() 方法用于移除字符串头尾指定的字符(默认为空格)。

语法:

str.strip([chars]);

返回值:

返回移除字符串头尾指定的字符生成的新字符串。

例子:

>>> str = "0000000this is string example....wow!!!0000000"
>>> str.strip(‘0‘)
‘this is string example....wow!!!‘

 

python学习之strip()

标签:family   amp   str   sof   指定   log   ros   移除   sharp   

原文地址:http://www.cnblogs.com/leomei91/p/7656602.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!