python中raw_input().strip().split()

参考: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 

 

 

 

 

 

posted @ 2017-09-09 14:25  _Cohen  阅读(1867)  评论(0)    收藏  举报