首页 > 其他 > 详细

strip()函数

时间:2019-07-20 15:19:54      阅读:110      评论:0      收藏:0      [点我收藏+]

先说一下strip()函数

描述:python strip()只能用于移除string 开头或结尾的charts(默认情况下为‘/n‘,‘/t‘,‘/r‘,‘ ‘)  string.strip(chars=None,/),有返回值

string="hello,world"
a=string.strip(‘l‘)
print(a)

a="hello,world"

string="hello,world"
string.strip(‘l‘)
print(string)

"hello,world"

string="hello,world"
a=string.strip(‘h‘)
print(a)

a="ello.world"

 

strip()函数

原文:https://www.cnblogs.com/kkouba/p/11217080.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!