Printing Hidden Character in Python

Wijaya Edward ewijaya at i2r.a-star.edu.sg
Thu Oct 26 05:06:37 EDT 2006


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.sg at python.org on behalf of Ben Finney
Sent: Thu 10/26/2006 4:59 PM
To: python-list at python.org
Subject: Re: Printing Hidden Character in Python



Wijaya Edward <ewijaya 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