QuickSnip LogoA light blue logo with a thunderbolt in bracketsQuickSnip

Remove Whitespace

Removes all whitespace from a string.

  • string
  • whitespace
  • remove

Code

def remove_whitespace(s):
    return ''.join(s.split())

Usage

remove_whitespace('hello world') # Returns: 'helloworld'