我发现用Python读取二进制文件特别困难。你能帮我一把吗?我需要读取这个文件,在Fortran 90中,该文件很容易被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程序,读取这个二进制文件,然后保存我需要使用的数据?