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

print "\\n"

On Oct 26, 2:06 am, Wijaya Edward <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED] on behalf of Ben Finney
> Sent: Thu 10/26/2006 4:59 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Printing Hidden Character in Python
>
> 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"
>
> --
>  \      "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.
> --------------------------------------------------------

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to