收集中......

s = 'mathsdfhgdfdelphi'
print(s.startswith('math'))#判断开始字符
print(s.endswith('delphi'))#判断结束字符
print(s.lstrip('math'))#删掉左边字符
print(s.rstrip('delphi'))#删除右边字符
print(s)
True
True
sdfhgdfdelphi
mathsdfhgdf
mathsdfhgdfdelphi
View Code

 

posted on 2018-05-08 10:40  math98  阅读(98)  评论(0)    收藏  举报