> -Original Message-
> From:
> [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> rg] On Behalf Of Scott David Daniels
> Sent: 03 October 2006 18:11
> To: python-list@python.org
> Subject: Re: Raw strings and escaping
>
> Matthew Warren wrote:
> >
Matthew Warren wrote:
> Hi,
>
> I would expect this to work,
>
> rawstring=r'some things\new things\some other things\'
>
> But it fails as the last backslash escapes the single quote.
Note something many people don't when looking over the string rules:
astring = r'some things\new things\som
Jon Ribbens <[EMAIL PROTECTED]> wrote:
> Well, hardly *much* harder:
>
> pattern = r"""foo"""
It means you have to always triple quote your raw strings or know in
advance of writing the regular expression which of r'', r"", r'',
r"" is most appropriate. The way it works at the moment
In article <[EMAIL PROTECTED]>, Duncan Booth wrote:
>> I presume there was originally some reason for this bizarre behaviour
>> - it'd be interesting to know what it is/was, if anyone knows?
>>
> See the FAQ for the explanation:
>
> http://www.python.org/doc/faq/general/#why-can-t-raw-strings-r-s
Matthew Warren wrote:
> I would expect this to work,
>
> rawstring=r'some things\new things\some other things\'
>
> But it fails as the last backslash escapes the single quote.
raw string literals are parsed in exactly the same way as ordinary string
literals; it's
just the mapping from the stri
Jon Ribbens <[EMAIL PROTECTED]> wrote:
> I presume there was originally some reason for this bizarre behaviour
> - it'd be interesting to know what it is/was, if anyone knows?
>
See the FAQ for the explanation:
http://www.python.org/doc/faq/general/#why-can-t-raw-strings-r-strings-end-with-a-bac
In article <[EMAIL PROTECTED]>, Matthew Warren wrote:
> I would expect this to work,
>
> rawstring=r'some things\new things\some other things\'
>
> But it fails as the last backslash escapes the single quote.
String constants in Python are weird - raw strings doubly so.
In a raw string, backslas
"Matthew Warren" <[EMAIL PROTECTED]> wrote:
> I would expect this to work,
>
> rawstring=r'some things\new things\some other things\'
>
> But it fails as the last backslash escapes the single quote.
>
> ..although writing this I think I have solved my own problem. Is \'
> the only thing escaped
Matthew Warren wrote in news:mailman.1152.1159872720.10491.python-
[EMAIL PROTECTED] in comp.lang.python:
> I would expect this to work,
>
> rawstring=r'some things\new things\some other things\'
It in the docs:
http://docs.python.org/ref/strings.html#l2h-14>
... Specifically, a raw string ca
Hi,
I would expect this to work,
rawstring=r'some things\new things\some other things\'
But it fails as the last backslash escapes the single quote.
..although writing this I think I have solved my own problem. Is \' the
only thing escaped in a raw string so you can place ' in a raw string?
Alt
10 matches
Mail list logo