Python笔记——string.strip()

来源:互联网 发布:华为s5700绑定mac地址 编辑:程序博客网 时间:2024/06/14 07:44

参考网址:http://www.tutorialspoint.com/python/pdf/string_strip.pdf

函数描述:

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

语法:

      str.strip([chars]);

参数:

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

例子

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

结果:

     this is string example....wow!!!


0 0