Ned Batchelder <> writes:

> On Friday, October 14, 2016 at 12:50:44 PM UTC-4, Lele Gaifax wrote:
>> Chris Angelico <> 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')
>     'foo\\s+bar'

Thanks for the clarification.

I tested the above syntax and works flawlessly on 2.7, 3.5 and 3.6b2, and I
will therefore suggest it on

bye, lele.
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.  |                 -- Fortunato Depero, 1929.


Reply via email to