"Wayne Watson" <sierra_mtnv...@sbcglobal.net> wrote
    raw_image=raw_file.read()

One more question, when I tried (no 'wb') read(size=307200), why di read balk at size, syntactically.

It doesn't balk at the size syntactically it finds what it thinks is an End Of file character code in the data and stops reading. That's how text files are terminated and why you need to use rb to read non text data. Having read it as binary its then up to you to interpret the binary byte stream in whatever way you need, for example decoding it with the struct module or treating it as an image for PIL to manipulate or whatever.

HTH,


--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/l2p/

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to