+ 1
How to remove all white spaces in python?
2 Antworten
+ 2
Check this code and look at it to understand
https://code.sololearn.com/c9iCOhI4tKmv/?ref=app
0
If it's just for the blanks (spaces) in the front and back of a string, you can use the string methods lstrip(), rstrip() and strip().
If you need to remove all spaces in a string, you could run a list comprehension with an if clause over the string and recombine the resulting list of characters with a join.
For all cases, see an example here: https://code.sololearn.com/c36vdj236cL6