How do I express a backslash in a string?

Tobiah toby at tobiah.org
Wed Aug 22 14:25:13 EDT 2007


Tobiah wrote:
>>>> "'"
> "'"
>>>> "\'"
> "'"
>>>> "\\'"
> "\\'"
>>>> "\\\'"
> "\\'"
>>>>   
> 
> This is quite different than any other language
> that I am used to.  Normally, a double backslash
> takes away the special meaning of the last backslash,
> and so you are left with a single backslash.
> 
> How do I express the single backslash?
> 
> Thanks,
> 
> Tobiah

A little more looking, and I see:


>>> "\\'"
"\\'"
>>> len("\\'")
2
>>>     


So it was just the console representation that was fooling
me into thinking that I had a double backslash.

-- 
Posted via a free Usenet account from http://www.teranews.com




More information about the Python-list mailing list