Sujet : Re: Correct syntax for pathological re.search()
De : ram (at) *nospam* zedat.fu-berlin.de (Stefan Ram)
Groupes : comp.lang.pythonDate : 07. Oct 2024, 15:32:06
Autres entêtes
Organisation : Stefan Ram
Message-ID : <backslash-20241007152827@ram.dialup.fu-berlin.de>
References : 1 2 3
"Michael F. Stemper" <
michael.stemper@gmail.com> wrote or quoted:
For now, I'll use the "r" in a cargo-cult fashion, until I decide which
syntax I prefer. (Is there any reason that one or the other is preferable?)
I'd totally go with the r-style notation!
It's got one bummer though - you can't end such a string literal with
a backslash. But hey, no biggie, you could use one of those notations:
main.py
path = r'C:\Windows\example' + '\'
print( path )
path = r'''
C:\Windows\example\
'''.strip()
print( path )
stdout
C:\Windows\example\
C:\Windows\example\
.