小册名称:Python合辑2-字符串常用方法
3、lstrip()
移除字符串左侧指定的字符(默认为空格或换行符)或字符序列。
s = ' hello '.lstrip()print(s)# hello
s = ' hello '.lstrip()
print(s)
# hello
同样的,可以移除左侧所有包含在字符集中的字符串。
s = 'Arthur: three!'.lstrip('Arthur: ')print(s)# ee!
s = 'Arthur: three!'.lstrip('Arthur: ')
# ee!