+ 6

[Solved] Why does my Python strip function not work?

https://code.sololearn.com/cTe63xuS2M6j/?ref=app

12th Feb 2020, 2:04 AM
Sonic
Sonic - avatar
6 Réponses
+ 6
What do you mean by not working? strip() removes whitespaces from the beginning and end of the string. But your test string did not have any extra spaces anyway.
12th Feb 2020, 2:17 AM
Tibor Santa
Tibor Santa - avatar
+ 5
Tibor Santa thanks. I was under the impression that it removes all white space! My bad.
12th Feb 2020, 2:23 AM
Sonic
Sonic - avatar
+ 4
Sonic You can also remove spaces from a single side with rstrip() or lstrip(). 🙂
12th Feb 2020, 3:49 AM
Jan Markus
+ 4
Sonic You are welcome! 🙂👍
12th Feb 2020, 4:53 AM
Jan Markus
+ 3
Original code modified.
12th Feb 2020, 2:27 AM
Sonic
Sonic - avatar
+ 2
Jan Markus thanks for the info! 👍
12th Feb 2020, 4:50 AM
Sonic
Sonic - avatar