Am Tue, 12 Jul 2005 06:47:50 -0700 schrieb [EMAIL PROTECTED]: > Hi, > > I want to append one (huge) file to another (huge) file. The current > way I'm doing it is to do something like: > > infile = open (infilename, 'r') > filestr = infile.read() > outfile = open(outfilename, 'a') > outfile.write(filestr) > > I wonder if there is a more efficient way doing this? > Thanks.
I guess (don't know), that this is faster: for line in infile: outfile.write(line) At least if this a file with "lines". If it is a binary file, you could read N bytes at once: infile.read(N) Thomas -- Thomas Güttler, http://www.thomas-guettler.de/ -- http://mail.python.org/mailman/listinfo/python-list