Re: Create a backslash-escaped version of a string?

2010-02-13 Thread Aahz
In article , boblatest wrote: > >I'd like to have control characters in a string to be converted to >their backslash-escaped counterparts. I looked in the encoders section >of the string module but couldn't find anything appropriate. I could >write it myself but I'm sure something of the sort exi

Re: Create a backslash-escaped version of a string?

2010-02-08 Thread boblatest
On Feb 8, 12:28 pm, Chris Rebert wrote: > print a.encode("string-escape") How could I miss that? I was on that doc page already. Should have typed "/escape" in the browser ;-) Thanks, robert -- http://mail.python.org/mailman/listinfo/python-list

Re: Create a backslash-escaped version of a string?

2010-02-08 Thread Chris Rebert
On Mon, Feb 8, 2010 at 3:14 AM, boblatest wrote: > Hello, > > I'd like to have control characters in a string to be converted to > their backslash-escaped counterparts. I looked in the encoders section > of the string module but couldn't find anything appropriate. I could > write it myself but I'm

Create a backslash-escaped version of a string?

2010-02-08 Thread boblatest
Hello, I'd like to have control characters in a string to be converted to their backslash-escaped counterparts. I looked in the encoders section of the string module but couldn't find anything appropriate. I could write it myself but I'm sure something of the sort exists. The hypothetical method "