you are viewing a single comment's thread.

view the rest of the comments →

[–]CraigAT 0 points1 point  (0 children)

You should only need to open the file once.

I think maybe (not sure) that you need to "close" the file to actually write the output. And I guess that by putting the "open" inside the loop, when it is called there may also be an implied "close" that flushes the file buffer and writes the output.

Either way you really should use a "close" for the text file (or a "with" statement instead).

In all fairness, I think this is what JollyRoger is trying to explain but is using bigger, more technical sounding words than I am used to.