lstrip() method returns a copy of the string with leading characters removed (based on the string argument passed). If no argument is passed, it removes leading spaces.
characters [optional] : A set of characters to remove as leading characters.
Returns: Returns a copy of the string with leading characters stripped.
ks for geeks
Code #4: Runtime Error
There is a runtime error when we try to strip anything except a string.
print(list.lstrip()) AttributeError: 'list' object has no attribute 'lstrip'
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course