[portland] Not Seeing Script Error(s)

Rich Shepard rshepard at appl-ecosys.com
Wed Nov 23 00:05:41 CET 2011


On Tue, 22 Nov 2011, Ethan Furman wrote:

> They are closed automatically.

   Ah, so.

> It's not good practice to do this way, though better would be to assign
> the open files to their own name, then you could 'name.close()' when you
> were done.

Ethan,

   That's what I thought you did in the lines

reader = csv.reader(open(filename,"r"),
                     delimiter="|",
                     quotechar="'")

output = csv.writer(open("out.txt","w"),
                     delimiter="|",
                     quotechar="'")

   but reader.close() and output.close() generated python errors.

Rich




More information about the Portland mailing list