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