The Python Oracle

Remove all whitespace in a string

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Over a Mysterious Island

--

Chapters
00:00 Question
00:32 Accepted answer (Score 2238)
01:14 Answer 2 (Score 405)
02:04 Answer 3 (Score 146)
03:01 Answer 4 (Score 61)
03:40 Thank you

--

Full question
https://stackoverflow.com/questions/8270...

Accepted answer links:
[str.strip()]: http://docs.python.org/2/library/stdtype...
[str.replace()]: http://docs.python.org/2/library/stdtype...
[any other whitespace]: https://en.wikipedia.org/wiki/Whitespace...
[str.split()]: http://docs.python.org/2/library/stdtype...

Answer 2 links:
[str.replace]: http://docs.python.org/2/library/stdtype...
[split]: http://docs.python.org/2/library/stdtype...
[join]: http://docs.python.org/2/library/stdtype...
[strip]: http://docs.python.org/2/library/stdtype...
[lstrip]: http://docs.python.org/2/library/stdtype...
[rstrip]: http://docs.python.org/2/library/stdtype...

Answer 3 links:
[these strange white-space characters]: http://en.wikipedia.org/wiki/Whitespace_...

Answer 4 links:
[str.translate]: http://docs.python.org/3/library/stdtype...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #trim #removingwhitespace

#avk47