To remove whitespace from the start of a string in Python, you can use the lstrip()
string method. Here's an example:
main.py101 chars4 lines
The lstrip()
method removes any whitespace characters, including spaces, tabs, and newline characters, from the start (left side) of the string. If you want to remove whitespace from the end or both ends of the string, you can use the rstrip()
and strip()
string methods, respectively.
gistlibby LogSnag