Python lStrip()返回字符串的副本,其中所有字符都已从字符串的开头剥离(默认空格字符)。
str.lstrip([chars])
chars - 您可以提供必须修剪的字符。
此方法返回字符串的副本,其中所有字符都已从字符串的开头剥离(默认空格字符)。
下面的示例显示了lStrip()方法的用法。
#!/usr/bin/python str=" this is string example....wow!!! "; print str.lstrip() str="88888888this is string example....wow!!!8888888"; print str.lstrip('8')
当无涯教程运行上面的程序时,它产生以下输出-
this is string example....wow!!! this is string example....wow!!!8888888
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)