os.path.isfile

Erik python at lucidity.plus.com
Sun Feb 12 19:29:46 EST 2017


On 13/02/17 00:13, Chris Angelico wrote:
> On Mon, Feb 13, 2017 at 11:11 AM, Chris Angelico <rosuav at 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.



More information about the Python-list mailing list