How to match whitespace but not newlines using Python regular expressions?

PythonServer Side ProgrammingProgramming

The following code matches only the whitespaces but not newlines in the given string

Example

import re
print re.findall(r"(\s){1,}","""I find
    Tutorialspoint useful""")

Output

This gives the output

[' ', ' ', ' ']

raja
Published on 10-Jan-2018 10:39:55
Advertisements