I have a fortran program generating unformatted files and I am trying to read them into Python.
I have the source code so I know the first "chunk" is a character array of character*1 name(80)
and so on. So I start out with
f = open(filename,'rb')
bytes = 80
name = struct.unpack('c'*bytes,f.read(bytes))
and name
is an 80-length tuple consisting of strings of length 1; some of the contents of which are hexadecimal strings (e.g., \x00
). How can I go about converting this variable to a single ascii string?