Xiao Jianfeng wrote: > I have compared the two methods, > (1). "for x in fh:" > (2). read all the file into memory firstly. > > I have tested the two methods on two files, one is 80M and the second > one is 815M. > The first method gained a speedup of about 40% for the first file, and > a speedup > of about 25% for the second file. > > Sorry for my bad English, and I hope I haven't made people confused.
So is the problem solved ? Putting buffering implementation aside, (1) is the way to go as it runs through content only once. -- http://mail.python.org/mailman/listinfo/python-list