Re: open two files at once

2010-08-21 Thread Peter Otten
robek wrote: > what is the simplest way to open two files (one for reading and 2nd for > writing) ? > i usually do: > with open('1') as f1: >with open('2','w') as f2: > for i in f1: do something with i >f2.write(i) > > is there a simpler/better way to do this ? Yours is the best

open two files at once

2010-08-21 Thread robek
hi, what is the simplest way to open two files (one for reading and 2nd for writing) ? i usually do: with open('1') as f1: with open('2','w') as f2: for i in f1: do something with i f2.write(i) is there a simpler/better way to do this ? -- http://mail.python.org/mailman/listinfo/py