[Python] Remove Whitespace From a String Posted on August 31, 2010 in Programming >>> print "".join(" hello world ".split()) helloworld The key to the above is that split() separates the string on any amount of whitespace when no separator is specified. python