The output of
od -Ax -t x1z /home/mmeclimate/test/test.dat
is my preferred way of dumping binary data in an unambiguous textual representation.
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
There are some conversion functions in the module binascii . For example you can convert to readable hex format with binascii.hexlify . I don't know if it's what you're looking for.
Gribouillis
Posting Maven
2,786 posts since Jul 2008
Reputation Points: 1,044
Solved Threads: 691
I'm assuming you want to do more with it than just print it.
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
I thought you said the format was unknown to you?
Reading it in isn't the problem.
Working out what all the bytes mean is.
Without a nice clean dump of some of the data, figuring that bit out will be next to impossible.
Do you have any idea what the data is?
Or do we take a guess based on your chosen username and first post?
http://clusty.com/search?query=mme+climate&sourceid=Mozilla-search
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953
I might be fishing here, but is this a Macintosh binhex4 format file?
vegaseat
DaniWeb's Hypocrite
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
Well the output of od would enable you to confirm such things as
- whether 2 or 4 byte integers were used
- whether 4 or 8 byte floats were used
- whether the data is stored in big-endian or little-endian format
- whether there is a header, say perhaps containing the number of records.
and so on.
If you know (or at least have some idea) what the format is, then you can start writing code to deal with it.
Do you have an application which also reads this file, and can display the results?
Salem
Posting Sage
11,531 posts since Dec 2005
Reputation Points: 5,862
Solved Threads: 953