Answers for "lstrip()"

0

lstrip()

# Only leading whitespaces are removed
text1 = '   Python Programming   '
print(text1.lstrip())


# Remove the whitespace and specified character at
# leading end
text2 = '       code its my code        '
print(text2.lstrip(' code'))

# Remove the specified character at 
# leading end
text3 = 'code its my code'
print(text3.lstrip('code'))
Posted by: Guest on September-25-2021
0

.lstrip()

Remove spaces to the left of the string:

txt = "     banana     "

x = txt.lstrip()

print("of all fruits", x, "is my favorite")
Posted by: Guest on September-08-2021

Python Answers by Framework

Browse Popular Code Answers by Language