raw strings and \

plahey at alumni.caltech.edu plahey at alumni.caltech.edu
Sun Mar 5 18:43:43 CET 2006


Hi Alex,

thanks for the reply.  I can see that there is a choice that needed to
be made.  Before I was aware of the \ issue I just used (yes it has
come up, but the example is at work) triple quotes to work around the
embedded quote issue:

x=r'''It's like this "c:\blah\" ok?'''
print x
It's like this "c:\blah\" ok?

Am I missing something?

I guess my point is that it is quite surprising that r'\' is not a
legal way to represent a backslash.  I look for consistency in the
tools that I work with and this except-for-the-last-character exception
is annoying (I admit it might be a silly use-case but consistency is
consistency).

Again, thanks for taking the time to reply.

Now get back to work on your new Nutshell book :-)




More information about the Python-list mailing list