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
  • 4,895
  • 3
  • 29
  • 46
mommomonthewind
  • 3,831
  • 10
  • 39
  • 68

1 Answers1

5

Use str.lstrip():

In [28]: s = "___abc_de"

In [29]: s.lstrip('_')
Out[29]: 'abc_de'
Mazdak
  • 100,514
  • 17
  • 155
  • 179