Given a string ___abc_de
I want to remove _
character if it is at the beginning of the string.
So the above string should be abc_de
.
Given a string ___abc_de
I want to remove _
character if it is at the beginning of the string.
So the above string should be abc_de
.
Use str.lstrip()
:
In [28]: s = "___abc_de"
In [29]: s.lstrip('_')
Out[29]: 'abc_de'