How to remove tabs and newlines using Python regular expression?

PythonServer Side ProgrammingProgramming

The following code removes tabs and newlines from given string

Example

import re
print re.sub(r"\s+", " ", """I find
Tutorialspoint helpful""")

Output

This gives output

I find Tutorialspoint helpful
raja
Published on 08-Jan-2018 18:05:25
Advertisements