Printing Hidden Character in Python
Fulvio
fulvio at tm.net.my
Fri Oct 27 01:56:47 EDT 2006
***********************
Your mail has been scanned by InterScan MSS.
***********************
On Thursday 26 October 2006 16:43, Wijaya Edward wrote:
> How can we print out the hidden character like
> "\n", "\r" etc in Python?
If it's meant to evidentiate then you should scan each byte an print it out
i.e.
o = open('yourfile'.'rb')
>>> o = open('paths.con','rb')
>>> for c in o.read():
... if c == '\n':
... print '\\n'
... if c == '\r':
... print '\\r'
... print c,
...
unfortunately it will be a space between each letter. Maybe using
sys.stderr.write (c) will avoid that.
F
More information about the Python-list
mailing list