On 13/02/17 00:13, Chris Angelico wrote:
On Mon, Feb 13, 2017 at 11:11 AM, Chris Angelico <ros...@gmail.com> wrote:
The string "\t" gets shown in the repr as "\t". It is a string
consisting of one character, U+0009, a tab. The string r"\t" is shown
as "\\t" and consists of two characters, REVERSE SOLIDUS and LATIN
SMALL LETTER T. That might be why you think there's confusing stuff
happening :)

Oh, and the other trap you can fall into is the reverse of that:

"worl\d"
'worl\\d'

This one actually triggers a warning in sufficiently-recent Pythons:

Fair point, but you're going off at a tangent. I just stuck a backslash on a random letter to see which string tokens were/were not being treated as "raw" by the parser. Next time I'll use \v or something. You're focusing on something that is beside the point I'm trying to make ;)

E.
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to