Printing Hidden Character in Python

Fredrik Lundh fredrik at
Thu Oct 26 11:22:33 CEST 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)


More information about the Python-list mailing list