Pythonで特に読みにくいバイナリファイルが見つかりました。手伝って頂けますか? 私は、Fortran 90で簡単に詳細にPythonでバイナリファイルを読む
int*4 n_particles, n_groups
real*4 group_id(n_particles)
read (*) n_particles, n_groups
read (*) (group_id(j),j=1,n_particles)
によって読み取られ、このファイルを、読む必要が、ファイル形式は次のとおりです。
Bytes 1-4 -- The integer 8.
Bytes 5-8 -- The number of particles, N.
Bytes 9-12 -- The number of groups.
Bytes 13-16 -- The integer 8.
Bytes 17-20 -- The integer 4*N.
Next many bytes -- The group ID numbers for all the particles.
Last 4 bytes -- The integer 4*N.
は、どのように私は、Pythonでこれを読むことができますか?私はすべてを試みたが、それは決して働かなかった。私はPythonでこのバイナリファイルを読んで、私が使用する必要があるデータを保存するf90プログラムを使用する可能性はありますか?
このファイルは、Fortranプログラムによって書かれましたか?そうであれば、Fortranはデフォルトで、ファイルに書き込む各レコードの前に追加のデータを追加するので、どのように書かれましたか?データを読むときは、このことに注意する必要があります。 – Chris
私の以前のコメントを無視してください、intergers 8と4 * Nは明らかにこの追加のデータです。 – Chris
また、[バイナリファイルをPythonで読む](http://stackoverflow.com/questions/1035340/reading-binary-file-in-python)の回答を参照してください。 – Chris