数据小站
数据科学成长之路

字符操作

1.分开合并
strobj.split(‘,’) ==> [x.strip() for x in strobj.split(‘,’)]
a+’::’+b’::’ ==> ‘::’.join([..])
2.子串定位
in ==> ” in strobj
strobj.count(‘..’)
strobj.replace(”,”)
3.内置方法
strobj.[count,endswith/startwith,join,index,find,rfind,replace,strip/rstrip/lstrip,split,lower/upper,ljust/rjust]

赞(0) 打赏
未经允许不得转载:技术文档分享 » 字符操作

评论 抢沙发