help with pretty printing

Joachim Protze joachim.protze@tu-dresden.de
Mon Jun 25 11:05:00 GMT 2012


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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5319 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://sourceware.org/pipermail/gdb/attachments/20120625/b8acad9f/attachment.p7s>


More information about the Gdb mailing list