"Moedeloos Overste" <[EMAIL PROTECTED]> wrote > One question: When I run the program from IDLE it writes the data to > file > but when I run it from the command prompt(win32) it doesn't. why is > this?
How do you know? Have you searched for the file? Or are you looking in the same file that IDLE produced? I would expect the code to create a new file in the current directory - wherever you started the program. Did you look there? ----------------------- while vDraws > 0: LotNumbers = random.sample(range(1,45), 6) #random numbers from range into list) strgOutput=",".join(str(i) for i in LotNumbers) #??????converting list to string to store it. fout = open("draw__output.dat", "a") fout.write(strgOutput + "\n") #writing string to file fout.close() -------------------------- It's probably better to put the open/close outside the loop fout = open(...,'w') while vDraws > 0 ... fout.write(strgOutput + '\n') vDraws -= 1 fout.close() That way you can use 'w' to write the file(unless you really want the previous runs to be in there too.) Also this will save the program opening and closing the file for each line which is quite a slow process. HTH, -- Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor