Am Thu, 04 Sep 2008 18:03:54 +0200 schrieb Fredrik Lundh: > >> I am trying to read a binary file [...] > > > f = open("a.bin", "rb") # read binary data > s = f.read() # read all bytes into a string > > import array, sys > > a = array.array("f", s) # "f" for float > if sys.byteorder != "big": > a.byteswap() > For more complicated structures, the struct module may help.
HTH. Martin -- http://mail.python.org/mailman/listinfo/python-list