| Deutsch English Français Italiano |
|
<backslash-20241007152827@ram.dialup.fu-berlin.de> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.nobody.at!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.python
Subject: Re: Correct syntax for pathological re.search()
Date: 7 Oct 2024 14:32:06 GMT
Organization: Stefan Ram
Lines: 29
Expires: 1 Jul 2025 11:59:58 GMT
Message-ID: <backslash-20241007152827@ram.dialup.fu-berlin.de>
References: <ve0o34$1nep4$1@dont-email.me> <backslashes-20241007145600@ram.dialup.fu-berlin.de> <ve0qct$1o839$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de 6JCbnLYYm4xMXI1x6R/M2A9J/h9mlvdZ3v17g409aFAvvr
Cancel-Lock: sha1:BdBuwZwMQqPNsWTN70cfjBnWf1w= sha256:JyeBoJVDHbOvROy1s1ZqICN1YfgSD+ooKGXVk5oSNFc=
X-Copyright: (C) Copyright 2024 Stefan Ram. All rights reserved.
Distribution through any means other than regular usenet
channels is forbidden. It is forbidden to publish this
article in the Web, to change URIs of this article into links,
and to transfer the body without this notice, but quotations
of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
services to mirror the article in the web. But the article may
be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
Bytes: 2081
"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\
.