How to remove leading whitespaces from a string in the Python?

1 Answer

Relevance
  • 2 months ago

    Hi, jhon.

    You would use the string.lstrip() function. Here's an example:

    a_string = "     hello"

    print (a_string.lstrip())

Still have questions? Get answers by asking now.