open two files at once

robek ta at ta.ta
Sat Aug 21 14:41:25 CEST 2010

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

is there a simpler/better way to do this ?

More information about the Python-list mailing list