参考:http://blog.csdn.net/yizhen_nlp/article/details/70442617
1、strip()方法
strip() 方法用于移除字符串头尾指定的字符(默认为空格)。
strip()方法语法: str.strip([chars]) 参数是chars--移除字符串头尾指定的字符.
例子如下:
#!/usr/bin/python str = "HHHH I am a student HHHHH"; print str.strip( 'H' ); #输出:I am a student