backslash plague
Alex Martelli
aleaxit at yahoo.com
Fri Oct 22 16:46:58 EDT 2004
Luis P. Mendes <luisXX_lupe2XX at netvisaoXX.pt> wrote:
> So, the trick is to put the r in front of the string?!
If you want a literal string with backslashes in it, you either double
each backslash or use a rawliteral (r in front).
> y='R0\1.2646\1.2649\D'
the third character of y, \1, is in this case the byte with value 1 in
the ASCII code, etc. Apparently that's not what you want.
But is this string going to be a literal in your code, rather than, say,
read from a file? Sounds unlikely. When you read from a file there's
no escape-sequence interpretation, so the issue of how to write
literals, raw or otherwise, is irrelevant there.
Alex
More information about the Python-list
mailing list