python strip
# removes outside whitespace/characters
' hey '.strip() # "hey"
' hey '.lstrip() # "hey "
' hey '.rstrip() # " hey"
'_.hey__'.strip('._') # "hey"
python strip
# removes outside whitespace/characters
' hey '.strip() # "hey"
' hey '.lstrip() # "hey "
' hey '.rstrip() # " hey"
'_.hey__'.strip('._') # "hey"
python strip()
a = " smurf "
a = a.strip()
#remove space at begining and end of string
print(a)
#smurf
strip() function
# Leading and trailing whitespaces are removed
text1 = ' Python Programming '
print(text1.strip())
# Remove the whitespace and specified character on
# both leading and trailing end
text3 = ' code its my code '
print(text3.strip(' code'))
# Remove the specified character at
# both leading and trailing end
text2 = 'code its my code'
print(text2.strip('code'))
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us