You are viewing a single comment's thread. Return to all comments →
.strip() is used for removing white spaces at the end and at the beginning of your string. lets take for example,
print " hello world "
there white spaces at the beginning and the end... if we use the command, like this,
print (" hello world ").strip()
it removes the spaces and prints
hello world
also if you want to remove the white space at the left side only, use .lstrip() and at the right side only use .rstrip()
do you get it now ?
Seems like cookies are disabled on this browser, please enable them to open this website
Python If-Else
You are viewing a single comment's thread. Return to all comments →
.strip() is used for removing white spaces at the end and at the beginning of your string. lets take for example,
there white spaces at the beginning and the end... if we use the command, like this,
it removes the spaces and prints
also if you want to remove the white space at the left side only, use .lstrip() and at the right side only use .rstrip()
do you get it now ?