Python\'s string.whitespace is great:
>>> string.whitespace \'\\t\\n\\x0b\\x0c\\r \'
How do I use this with a string without resor
What's wrong with the \s character class?
\s
>>> import re >>> pattern = re.compile(r'\s+') >>> re.sub(pattern, ' ', "Please \n don't \t hurt \x0b me.") "Please don't hurt me."