I have a Matlab code that I am trying to convert into Python. I have a binary output from a Fortran program which is read into Matlab using fread, fscanf and fseek. I would like to convert this into python, however I have not had any luck. Here is a sample from the Matlab script;
[fid,message]=fopen(fname,'r');
junk=' ';
while junk(1)~='P'
junk=fscanf(fid,'%s',1);
end
fseek(fid,-length(junk),0);
while ((sign~='+')&(sign~='-'))
sign=char(fread(fid,1));
end
fread(fid,2,'float');
fc=fread(fid,1,'float');
fread(fid,2,'float');
sd=fread(fid,1,'float');
Any help would be appreciated.