首页 > 编程语言 > 详细

python学习之strip()

时间:2017-10-12 16:43:08      阅读:205      评论:0      收藏:0      [点我收藏+]

定义:

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

语法:

str.strip([chars]);

返回值:

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

例子:

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

 

python学习之strip()

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!