Skip to content

Instantly share code, notes, and snippets.

@basilleaf
Created February 2, 2013 02:43
Show Gist options
  • Save basilleaf/4695874 to your computer and use it in GitHub Desktop.
Save basilleaf/4695874 to your computer and use it in GitHub Desktop.
Remove extraneous whitespace from multiline string
' '.join([s.strip() for s in my_str.splitlines()]).strip()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment