need reading file in binary mode

2005-12-01 Thread Sergey P. Vazulia
this part of my code:

f = file(work_dir + filename,'r')
n = int(totalSize/recordLenth)
i = 0
while i < n:
buf = f.read(recordLenth);

sometime (when find something like \0A\00\00 in data) returm less bytes then
file have.

Q: how-to read all data from binary file with constant_length portions?


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: need reading file in binary mode

2005-12-01 Thread Sergey P. Vazulia
Problem solved.


"Sergey P. Vazulia" <[EMAIL PROTECTED]> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ
ÓÌÅÄÕÀÝÅÅ: news:[EMAIL PROTECTED]
> this part of my code:
>
> f = file(work_dir + filename,'rb')
   ^
> n = int(totalSize/recordLenth)
> i = 0
> while i < n:
> buf = f.read(recordLenth);
>
> sometime (when find something like \0A\00\00 in data) returm less bytes
then
> file have.
>
> Q: how-to read all data from binary file with constant_length portions?
>
>


-- 
http://mail.python.org/mailman/listinfo/python-list