# -*- coding: UTF-8 -*- str = "00000003210Runoob01230000000" print(str.strip(‘0‘))# 去除首尾字符 0 str2 = " Runoob " print(str2.strip()) # 去除首尾空格
str = "123abcrunoob321" print (str.strip( ‘12‘ )) # 去除字符序列12
结果:
str = "123abcrunoob321"print(str.strip(‘12‘))# 字符序列为 12
原文:https://www.cnblogs.com/qjhh/p/12581205.html