1

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.

MrLeeh
  • 5,321
  • 6
  • 33
  • 51
mommomonthewind
  • 4,390
  • 11
  • 46
  • 74

1 Answers1

5

Use str.lstrip():

In [28]: s = "___abc_de"

In [29]: s.lstrip('_')
Out[29]: 'abc_de'
Mazdak
  • 105,000
  • 18
  • 159
  • 188