On Friday, October 14, 2016 at 12:50:44 PM UTC-4, Lele Gaifax wrote:
> Chris Angelico <ros...@gmail.com> writes:
> > There's a shift as of 3.6 to make unrecognized alphabetic escapes into
> > errors, or at least warnings.
> But we are talking about raw strings here, specifically r'\s+'.
> I agree that with plain strings it's a plus.

The raw string means the regex engine gets three characters: backslash,
s, plus.  It then has to decide what backslash-s means. In 3.6, this is
an error.  You'll need to escape the backslash for the regex engine:

    >>> re.sub(r'\s+', r'\\s+', 'foo bar')


Reply via email to