This is not what I meant.  My posting was a judgement error.  You are right 
though that my intuition was leading me to something like this.  However, I 
didn't realize that it was not necessary for what I was doing.  But this is 
very educational too.  It made me look up string decode, encode, and codecs 
in the library reference and I found out more about them.  I'm sure it's 
going to be useful.  Thanks!

Dan

"Scott David Daniels" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Dan Perl wrote:
>> Is there a way to convert a regular string to a raw string so that one 
>> could get from '\bblah' to r'\bblah' other than parsing the string and 
>> modifying the escapes?
>
> Assuming you might mean something else, that something else might be:
>
>    s = r'no_tab_\t_here'
>    len(s.split()) == 1
>    len(s.decode('string_escape').split()) == 2
>    s = 'tab_\t_here'
>    len(s.split()) == 2
>    len(s.encode('string_escape').split()) == 1
>
> -Scott David Daniels
> [EMAIL PROTECTED] 


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

Reply via email to