Re: help with pretty printing

Joachim Protze
2012-06-25T11:05:11Z

[-- Attachment #1: Type: text/plain, Size: 1319 bytes --]

Hi,
On 07.06.2012 20:26, Paul_Koning@Dell.com wrote:
> Yes, but since you're dealing with a regular (not raw) string here, the \ needs to be doubled, otherwise it is treated as a string character escape instead of a backslash character inside the string. So one of these will match space followed by asterisk:
your post let me wonder, why my code worked for me and I asked the
python interpreter for his opinion:

>>> '^QFile (
\*)?$'

'^QFile (
\\*)?$'

>>> '^QFile (
\\*)?$'

'^QFile (
\\*)?$'

>>> r'^QFile (
\*)?$'

'^QFile ( \\*)?$'

Equal output for all versions of these strings and for python versions
2.4, 2.6, 2.7 and 3.2 (the versions I found on severals machines).

- Joachim

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5319 bytes --]