Jose Rafael Pacheco wrote:
Hello,I want to read from a binary file called myaudio.dat Then I've tried the next code: import struct name = "myaudio.dat" f = open(name,'rb') f.seek(0) chain = "< 4s 4s I 4s I 20s I I i 4s I 67s s 4s I" s = f.read(4*1+4*1+4*1+4*1+4*1+20*1+4*1+4*1+4*1+4*1+4*1+67*1+1+4*1+4*1)
[snip] FYI, the struct module has a function called 'calcsize', so: s = f.read(struct.calcsize(chain)) -- http://mail.python.org/mailman/listinfo/python-list