python unpack little endian
<p><P>I'm trying to use Python read a binary file. The file is in LSB mode. I import the struct module and use unpack like this:</p>

<pre><code>f=open(sys.argv[1],'rb')
contents= unpack('&lt;I',f.read(4))[0]
print contents
f.close()
</code></pre>

<p><p>The data in the file is 0XC0000500 in LSB mode, and the actual value is 0X000500C0. So you can see the LSB mode's smallest size is per byte.
<p>However, I use a Mac machine, perhaps because of the version of my gcc or machine (I am not for sure. I just read the <a href="http://docs.python.org/library/struct.html" rel="nofollow">http://docs.python.org/library/struct.html</a> about the sizeof and sys.bitorder), the result from the above code is X0500C000, so the size of the LSB mode is 2Bytes. 
<p>How should I solve this problem?
<p>I will keep digging no matter this question is answered or not, and I will update if I ever get something.
<p>
Thanks in advance.
<p>:)</p>

<p>ps: The data file is an ELF file for a 32-bit machine. 
<p>pps: Since I am going to read a huge amount of data, and this is a general problem in the reading, so the manual way is not the best for me. Question is still open for answers. Thank you.
<p>ppps: &lt; means "little-endian,<b>standard size (16 bit)</b>" Now I read this...... I am going crazy...</p>
