[Tutor] repeated times

Anna Martelli Ravenscroft annaraven at gmail.com
Thu Nov 8 04:23:10 CET 2007

I'm not sure if this is what youre asking but if you want to collect  
all of the output into a file without overwriting, open the output  
file with " a" instead of "w" and the output will. be appended. Iwould  
suggest in that case that you include info about the user input so you  
can distinguish the output . Hth

Sent from my iPhone

On Nov 7, 2007, at 6:30 PM, "linda.s" <samrobertsmith at gmail.com> wrote:

> On 11/4/07, Aditya Lal <aditya.n.lal at gmail.com> wrote:
>> On 11/4/07, Thorsten Kampe <thorsten at thorstenkampe.de> wrote:
>>> * linda.s (Sun, 4 Nov 2007 01:39:46 -0800)
>>>> On Nov 2, 2007 1:03 AM, ALAN GAULD < alan.gauld at btinternet.com>  
>>>> wrote:
>>>>>>>> I want to run an .exe file and get the output many times.
>>>>>>> Given that I know that you know about loops I have to
>>>>>>> ask what you see as the problem?
>>>>>> I want to run it many times and export all the output to a text  
>>>>>> file.
>>>>> OK, Do you mean you want to run the program multiple times
>>>>> but put the output in the same file?
>>>> Yes. For example, I want to run the exe file one hundred times and
>>>> save all the results into one file.
>>>> Is there any example code to do that?
>>> There's no reason to do that in Python. You should use a batch or
>>> shell script for that. If you really insist on using Python then  
>>> look
>>> at the subprocess module...
>>> Thorsten
>> On Unix, you can execute "script <filename>" on the command prompt.  
>> This
>> will create a new session in which you execute the program as many  
>> times.
>> After you are done press ^D to come out of session. Everything of  
>> that
>> session will be saved in the file <filename>.
>> On Windows, you can probably build something like "script" in  
>> python. BTW,
>> does your executable takes any user inputs ?
>> --
>> Aditya
> My executable takes any user inputs and the input will be adjusted
> based on the former result. So I need do some analysis based on the
> output every time.
> hanks,
> Linda
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor

More information about the Tutor mailing list