Question about Reading Files
mats.rauhala at gmail.com
Sun Sep 5 01:23:02 CEST 2010
On 2010-09-04, genxtech <jrmy.lnrd at gmail.com> wrote:
> Hello. I am still really new to python and I have a project where I
> am trying to use the data files from another program and write a new
> program with new user interface and all. My first step was to open
> one of the files in 'rb' mode and print the contents, but I am
> unfamiliar with the format. Here is what was printed to the terminal:
> I am using Python 3.1 on a Fedora 13 box if that makes any difference.
> Any advise on how to decode the data would be greatly appreciated.
It's difficult to elaborate with only that information. What you have
done now is opened a file in read binary mode (r = read, b = binary) and
then tried to print it. Python has escaped the data as hex (\x01) and is
basically a hex dump of the data file.
For decoding the data, you either need to somehow figure out the format
of the data and then decode it accordingly. If you're on unix box the
'file' command might be of help.
If you're not on a unix box, you could check out how the file command
tries to find the type of the file. The man page for magic  could be
of help. Also see list of magic numbers 
More information about the Python-list