my_str.lstrip(char)
char
: (Optional ) char to be removed from left of the input string my_strmy_str=' Plus2net'
output=my_str.lstrip()
print(output) #Plus2net
# removes * from left
my_str='**plus2net'
output=my_str.lstrip('*')
print(output) #plus2net
# removes all char left of plus2net
my_str='**## welcome plus2net'
output=my_str.lstrip('*# welcome')
print(output) # plus2net
# removes from left only.
# Can't remove in between the string
my_str='22plus2net'
output=my_str.lstrip('2')
print(output) # plus2net
my_str='Rs 5000'
output=my_str.lstrip('Rs')
print(output) # 5000
my_str = "###***Hello"
print(my_str.lstrip("#*")) # Output: 'Hello'
price = "Rs 5000"
print(price.lstrip("Rs")) # Output: ' 5000'
num_str = "00012345"
print(num_str.lstrip("0")) # Output: '12345'
text = "***Python Programming"
print(text.lstrip("*")) # Output: 'Python Programming'
user_input = " Hello World!"
cleaned_input = user_input.lstrip()
print(cleaned_input) # Output: 'Hello World!'
All String methods Author
🎥 Join me live on YouTubePassionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.