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
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
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:
>
> baroo
> foobar
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
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
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 characters.
>>> print "d:\thedir"
d: hedir
The solution is to use