En Tue, 22 Sep 2009 18:18:16 -0300, Jose Rafael Pacheco
escribió:
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
> char is 1 bytes long on Python (as per struct modules' definition)
Also, this is also another option for you to use instead of built-in struct.
http://www.sis.nl/python/xstruct/xstruct.shtml
--
Regards,
Ishwor Gurung
--
http://mail.python.org/mailman/listinfo/python-list
Jose,
Hi
Note: I've worked with struct but a while ago so might be rusty a bit.
Also, this sounds a bit like a homework. If it is a homework please do
it yourself(or at least try) as you'd otherwise never know the
knowledge behind it on real-world scenario :-)
Having said that I am giving you bel
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+
On Tue, Sep 22, 2009 at 4:30 PM, 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)
Don't bother to seek(0) on a file you just opened.
> chain = "