On 09/01/2013 07:40 PM, Tim Roberts wrote:

Another altrnative is to use "raw" strings, in which backslashes are not
interpreted:
     a = r'E:\Dropbox\jjfsdjjsdklfj\sdfjksdfkjslkj\flute.wav'
     a.split(r'\')

Not quite.

--> r'\'
  File "<stdin>", line 1
    r'\'
       ^
SyntaxError: EOL while scanning string literal

In a raw string, the backslash is buggy (IMNSHO) when it's the last character. Given the above error, you might think that to get a single-quote in a string delimited by single-quotes that you would use r'\'', but no:

--> r'\''
"\\'"

you get a backslash and a single-quote.  And if you try to escape the backslash 
to get only one?

--> r'\\'
'\\\\'

You get two.  Grrrr.

--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to