On 07/28/2010 11:32 PM, Christopher Barker wrote:
> Paul Probert wrote:
>> I'm trying to write numpy arrays as binary data, to support a legacy
>> file format. So I open a file and write to it:
>>
>> fp = open('somefile','w')
>> ...
>> oldpos = fp.tell()
>> somenumpyarray.tofile(fp)
>> newpos
Paul Probert wrote:
>I'm trying to write numpy arrays as binary data, to support a legacy
> file format. So I open a file and write to it:
>
> fp = open('somefile','w')
> ...
> oldpos = fp.tell()
> somenumpyarray.tofile(fp)
> newpos = fp.tell()
> diff = newpos - oldpos - somenumpyarray.nbyte
All,
I'm trying to write numpy arrays as binary data, to support a legacy
file format. So I open a file and write to it:
fp = open('somefile','w')
...
oldpos = fp.tell()
somenumpyarray.tofile(fp)
newpos = fp.tell()
diff = newpos - oldpos - somenumpyarray.nbytes
if diff != 0:
print 'ahhah!