How to remove leading whitespace in Python

Removing leading spaces from a string removes all whitespace characters that precede the string. For example, removing leading whitespace from ” abc a ” results in “abc”.

Solution for How to remove leading whitespace in Python : You can use str.lstrip() to remove leading whitespace Call str.lstrip() with a string as str to remove all leading whitespace.


how-to-remove-leading-whitespace-in-python