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 

 

 

 

 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM