lstrip()
« All String methods
Removes space or chars from left side of the string
my_str.lstrip(char)
char
: (Optional ) char to be removed from left of the input string my_str
Returns the string after removing chars from left of the string.
my_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
« All String methods
← Subscribe to our YouTube Channel here
This article is written by plus2net.com team.
https://www.plus2net.com
plus2net.com