[Tutor] help--- opening csv in different functions

Alan Gauld alan.gauld at btinternet.com
Fri Aug 10 18:41:45 CEST 2012


On 10/08/12 11:02, leon zaat wrote:
> I am trying to fill a file.

I assume you mean create a file? Or overwrite an existing one?
Or append to an existing one. There isn't really a concept of filling a 
file, they just keep getting bigger until you ruin out of space.
(There are some filesystems that support creating fixed size files but 
they are very marginal cases)


> The seems to work, but after 200.00 entries i got the message that
> opening is not allowed.
> What i am doing wrong?

You shouldn't be continually opening the file... And when you do you 
should be sure to close it again as soon as possible.

> Is there a way to open the file once.

Yes that's usually what you would do.
Open it, collect your data and write it out (either as you collect
it or all at once as you prefer) then close the file.

> When i  didn't open it in the first part, it said it couldn't find the
> file.

Not sure what that means but if you haven't created it any attempt to 
read it will fail. But your code was way too long for me to be bothered 
reading through, sorry.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list