首页 > 编程语言 > 详细

【python-strip】Python strip()方法

时间:2017-11-17 19:42:04      阅读:331      评论:0      收藏:0      [点我收藏+]

strip()方法用于移除字符串首尾的指定字符(默认是空格)

比如:

str = "0000000this is string example....wow!!!0000000";
print str.strip( ‘0‘ );
结果:this is string example....wow!!!

str = "0000000this is string 0000example....wow!!!0000000";
print str.strip( ‘0‘ );
结果:this is string 0000example....wow!!!

只移除首尾,不移除中间的值


 
 

【python-strip】Python strip()方法

原文:http://www.cnblogs.com/liuyl-2017/p/7852818.html

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