How do I extract a ieee-be binary file embedded in a zipfile?
<p>I have a set of zip files which contains several ieee-be encoded binary and text files. I have used Pythons ZipFile module and can extract the contents of the text file</p>

<pre><code>def readPropFile(myZipFile):
    zf = zipfile.ZipFile(myZipFile,'r') # Open zip file for reading
    zFileList=zf.namelist() # extract list of files embedded in _myZipFile_

    # text files in _myZipFile_ contain the word 'properties' so 
    # get a list of the property files here
    for f in zFileList:
        if f.find('properties')&gt;0:
            propFileList.append(f)

    # open first file in propFileList
    pp2 = cStringIO.StringIO(zf.read(propFileList[0])) 
    fileLines = []
    for ll in pp2:
        fileLines.append(ll)

    # return the lines in the property text file
    return fileLines
</code></pre>

<p>Now I would like to do the same sort of thing except reading the data in the binary files and creating an array of floats. So how would I proceed?</p>

<h3>Update 1</h3>

<p>The format of the binary files is such that in MATLAB I after extracting them to a temporary location I can read them with the following</p>

<pre><code>&gt;&gt;fid=fopen('dataFile.bin','r','ieee-be');
&gt;&gt;dat=fread(fid,[1 inf],'float');
</code></pre>

<h3>Update 2</h3>

<p>I now have a simple function in attempt to read the binary data something like</p>

<pre><code>def readBinaryFile(myZipFile):
    zFile = zipfile.ZipFile(myZipFile,'r')
    dataFileName = 'dataFile.bin'
    stringData = zFile.read(dataFileName)
    ss=stringData[0:4]
    data=struct.unpack('&gt;f',ss)
</code></pre>

<p>but the value I get does the same as the value reported in MATLAB.</p>

<h3>Update 3</h3>

<p>first float in my binary file</p>

<ul>
<li>HEX value: BD 98 99 3D</li>
<li>float    : -.07451103</li>
</ul>
