[Please don't top-post replies. I've corrected it in this post.]
Wijaya Edward <[EMAIL PROTECTED]> writes:
> Ben Finney wrote:
> > Wijaya Edward <[EMAIL PROTECTED]> writes:
> > > How can we print out the hidden character like "\n", "\r" etc in
> > > Python?
> > What result do you want that you're not getting with:
> > print "\n"
>
> printing "line" will not show the hidden chars like "\n","\r".
> Is there a way to print it out?
Again, I don't know what result you want to see. The characters are
non-printable; what output do you expect?
If you want to see a Python string representation of the input, maybe
the 'repr' function is what you want.
>>> foo = "bar\tbaz\r\n"
>>> print foo
bar baz
>>> print repr(foo)
'bar\tbaz\r\n'
--
\ "The most common way people give up their power is by thinking |
`\ they don't have any." -- Alice Walker |
_o__) |
Ben Finney
--
http://mail.python.org/mailman/listinfo/python-list