[Tutor] Appending an extra column in a data file
Oscar Benjamin
oscar.j.benjamin at gmail.com
Wed Apr 10 23:49:07 CEST 2013
On 10 April 2013 22:17, eryksun <eryksun at gmail.com> wrote:
>
> But I think it's more readable to break up a long line like this:
>
> fin = open('old.dat')
> fout = open('new.dat', 'w')
>
> with fin, fout:
> for line in fin:
This has the same problems as contextlib.nested: An error raised while
opening 'new.dat' could prevent 'old.dat' from being closed properly.
Oscar
More information about the Tutor
mailing list