Re: write a 20GB file

2010-05-14 Thread Jackie Lee
Thanks to y'all. I should have be more careful reading the documentation. Cheers On Fri, May 14, 2010 at 10:07 PM, Martin v. Loewis wrote: >> The code works fine. I just don't know how f.write works. It says that >> file.write won't write the file until file.close or file.flush. > > You are misi

Re: write a 20GB file

2010-05-14 Thread Jackie Lee
(-2,1) f.write(struct.pack('>h',1)) f.seek(210,1) f.seek(ns*4,1) f.close() On Fri, May 14, 2010 at 6:04 PM, Dave Angel wrote: > Jackie Lee wrote: >> >> Hello there, >> >> I have a 22 GB binary file, a want to change values of specific >

write a 20GB file

2010-05-14 Thread Jackie Lee
Hello there, I have a 22 GB binary file, a want to change values of specific positions. Because of the volume of the file, I doubt my code a efficient one: #! /usr/bin/env python #coding=utf-8 import sys import struct try: f=open(sys.argv[1],'rb+') except (IOError,Exception): print '