String Strip in Python
Level 244 keystrokes
This removes leading and trailing whitespace. The strip() method returns a new string without whitespace at both ends.
Python code
# Create a string with spaces at both ends1text = " Hello World "# strip() removes leading and trailing whitespace# It does not remove spaces in the middle2print(text.strip())Output
Hello World
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this Python code and how often they appear.
"× 2(× 2)× 2.× 1=× 1