Script in Python to run a C program

Aahz Maruch aahz at
Thu Sep 21 06:03:55 CEST 2000

In article <00092100044500.01350 at localhost.localdomain>,
The Majestic Moined Mogul  <mogulNOSPAM at> wrote:
>Could someone please tell me how to best write a Python script that could
>execute a C program several times and compare the run times of each?

times = []
for i in range(numTests):
  start = time.time()
  end = time.time()
  times.append( (start,end) )

I don't claim this is "best", but it sure is simple.  You might want to
include a call to os.system(cmd) before the loop to pre-load the disk
                      --- Aahz (Copyright 2000 by aahz at

Androgynous poly kinky vanilla queer het    <*>
Hugs and backrubs -- I break Rule 6

Member of the Groucho Marx Fan Club  --Aahz

More information about the Python-list mailing list