lstrip()

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



plus2net.com



Post your comments , suggestion , error , requirements etc here




We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2020 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer