Nitro212

python looop plus timer

May 13th, 2011
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. ## Loop to Execute a command every xx seconds
  2. import time
  3. import os
  4. i = 90 ## seconds before the loop runs again
  5. os.system(r"otronivel.exe") ## run the command at start
  6. while True:
  7.     while i > 0:
  8.         os.system('cls')
  9.         print "Next Run In", i ## print the timer
  10.         time.sleep(1)
  11.         i -= 1
  12.     os.system('cls') ## run the command again for loop
  13.     ##print "Happy Birthday!"
  14.     os.system(r"otronivel.exe") ## command to execute
  15.     i = 90 ## seconds same seconds as the first
  16.     time.sleep(1)
Advertisement
Add Comment
Please, Sign In to add comment