detect endianness of a binary with python

H

Holger brunck

Hi all,
I use python 2.5 and I am looking for a possibility to determine a file type.
Especially the endianness of a file is needed for me. Is there a way to detect
this easily in python? Something like the "file" utility for linux would be very
helpfull.

Any help is appreciated.

Best regards
Holger Brunck
 
G

Grant Edwards

I use python 2.5 and I am looking for a possibility to determine a
file type. Especially the endianness of a file is needed for me. Is
there a way to detect this easily in python?

Only if you already know what's going to be in the file.
Something like the "file" utility for linux would be very helpfull.

Any help is appreciated.

You're going to have to describe in detail what's in the file before
anybody can help.
 
M

Michael Torrie

Only if you already know what's going to be in the file.


You're going to have to describe in detail what's in the file before
anybody can help.

There is a python module called "magic" that uses the same engine as
file to determine a file type. It's part of the "find" source code:

http://www.darwinsys.com/file/

On Fedora I can just yum install python-magic to get it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top