Python 3 interprets string literals as Unicode strings, and therefore \s is treated as an escaped Unicode character. Declare RegEx pattern as a raw string instead by prepending r