How do I exclude spaces? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do I exclude spaces?

I'm trying to exclude spaces in the user's input. How would I go about doing that?

21st Apr 2018, 5:02 AM
Jeff Myers
Jeff Myers - avatar
1 Answer
+ 3
You can use .strip(' ') to remove whitespace from the left and right side of the user input. Follow the link below to an excellent tutorial. https://www.dotnetperls.com/strip-JUMP_LINK__&&__python__&&__JUMP_LINK
21st Apr 2018, 5:10 AM
ODLNT
ODLNT - avatar