Printing Hidden Character in Python

Fredrik Lundh fredrik at pythonware.com
Thu Oct 26 05:22:33 EDT 2006


"Wijaya Edward" wrote:

> I mean while opening a file, like this
>
> for line in open('somefile.txt'):
>    print line
>
> printing "line" will not show the hidden chars like "\n","\r".
> Is there  a way to print it out?

    print repr(line)

</F> 






More information about the Python-list mailing list