Remove String from Left in Python

  • Post category:String

In this article, you will see how to remove string from left in Python. The lstrip() method removes all leading characters (characters at the beginning of a string) that match the characters specified in its argument.

Step 1: Create a string

str = "CodeAllow"
print("str = ", str)
print("str type = ", type(str))

Step 2: Remove string from left

print("Removed = ", str.lstrip("Code"))

Output:

str =  CodeAllow
str type =  <class 'str'>
Removed =  Allow

Free resources to learn advanced skills: AiHints and CodeAllow