Home
Head's Up: I'm in the middle of upgrading my site. Most things are in place, but there are something missing and/or broken including image alt text. Please bear with me while I'm getting things fixed.

Remove Arbitrary Leading Character From A Python String With .lstrip()

Passing a string of characters to [TODO: Code shorthand span ] will remove those characters from the start of the string being operated on. For example :

python
alfa = f"""  a  b  a

x a charlie"""

stripped = alfa.lstrip("ab \n")

print(f"START|{stripped}|END")
results start

Details

Footnotes And References