[Tutor] Appending an extra column in a data file
eryksun
eryksun at gmail.com
Thu Apr 11 00:09:13 CEST 2013
On Wed, Apr 10, 2013 at 5:49 PM, Oscar Benjamin
<oscar.j.benjamin at gmail.com> wrote:
>> 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.
Thanks for pointing out the potential bug there. It's not a big
problem in this case with the file open for reading. But, yeah, I'm
hanging my head in shame here... ;)
More information about the Tutor
mailing list