您的位置:首页 > 编程语言 > Python开发

Python笔记——string.strip()

2014-05-27 20:21 309 查看
参考网址:http://www.tutorialspoint.com/python/pdf/string_strip.pdf

函数描述:

返回一个去掉特殊字符的字符串副本。

语法:

str.strip([chars]);

参数:

chars——需要去掉的特殊字符。从字符串起始至末尾去掉chars。默认去掉字符串中的空格。

例子

#!/usr/bin/python
str = "0000000this is string example....wow!!!0000000";
print str.strip( '0' );


结果:

this is string example....wow!!!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: