Monday 15 April 2013

unix - How to run a python script 10 times per second -



unix - How to run a python script 10 times per second -

i have python script , want run script test.py 10 times per second.

i know how run script after specific interval, want run script number of times per second.

any help much appreciated. thanks

one thought utilize time , while loop following:

import time times = 10 def main(): pass # code here if __name__ == '__main__': time_start = time.time() # run main() function times times in 1 sec. = 0 while true: time_current = time.time() if time_current > time_start + / float(times): print('{}: {}'.format(i, time_current)) main() += 1 if > 9: break

fyi.

python-2.7 unix

No comments:

Post a Comment