Printing Hidden Character in Python

alex.ksikes at gmail.com alex.ksikes at gmail.com
Thu Oct 26 05:20:47 EDT 2006


Just escape the '\' character. So you would do:

print "\\n"

On Oct 26, 2:06 am, Wijaya Edward <ewij... at i2r.a-star.edu.sg> wrote:
> Ben,
>
> 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?
>
> -- Edward WIJAYA
> SINGAPORE
>
> ________________________________
>
> From: python-list-bounces+ewijaya=i2r.a-star.edu... at python.org on behalf of Ben Finney
> Sent: Thu 10/26/2006 4:59 PM
> To: python-l... at python.org
> Subject: Re: Printing Hidden Character in Python
>
> Wijaya Edward <ewij... at i2r.a-star.edu.sg> 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"
>
> --
>  \      "Two rules to success in life: 1. Don't tell people everything |
>   `\                                         you know."  -- Sassan Tat |
> _o__)                                                                  |
> Ben Finney
>
> --http://mail.python.org/mailman/listinfo/python-list
>
> ------------ Institute For Infocomm Research - Disclaimer -------------
> This email is confidential and may be privileged.  If you are not the intended recipient, please delete it and notify us immediately. Please do not copy or use it for any purpose, or disclose its contents to any other person. Thank you.
> --------------------------------------------------------




More information about the Python-list mailing list