Re: Using repr() with escape sequences

2006-02-27 Thread nummertolv
myString = "bar\foo\12foobar" print repr(myString) My "problem" was that I wanted to know if there is a way of printing "unraw" strings like myString so that the escape characters are written like a backslash and a letter or number. My understanding was that repr() did this and it does in most cas

Re: Using repr() with escape sequences

2006-02-23 Thread Daniel Dittmar
nummertolv wrote: > - Consider a string variable containing backslashes. > - One or more of the backslashes are followed by one of the letters > a,b,f,v or a number. > > myString = "bar\foo\12foobar" > > How do I print this string so that the output is as below? > > bar\foo\12foobar > > typing

Re: Using repr() with escape sequences

2006-02-23 Thread Sybren Stuvel
nummertolv enlightened us with: > myString = "bar\foo\12foobar" Are the interpretations of the escape characters on purpose? > How do I print this string so that the output is as below? > > bar\foo\12foobar Why do you want to? > typing 'print myString' prints the following: > > bar oo > foobar

Re: Using repr() with escape sequences

2006-02-23 Thread nummertolv
I think I might have misused the terms "escape character" and/or "escape sequence" or been unclear in some other way because I seem to have confused you. In any case you don't seem to be addressing my problem. I know that the \t in the example path is interpreted as the tab character (that was par

Re: Using repr() with escape sequences

2006-02-23 Thread Steven D'Aprano
On Thu, 23 Feb 2006 07:32:36 -0800, nummertolv wrote: > Hi, > > My application is receiving strings, representing windows paths, from > an external source. When using these paths, by for instance printing > them using str() (print path), the backslashes are naturally > interpreted as escape chara