I have a script that I would like to repeatedly run every 30 seconds, does anyone know how to do this? Also, a side question. Is it possible to have the output form the previous run replaced by the new output? Instead of it all stacking up every time the script outputs in the command prompt? Thanks for reading, and helping me learn.
frijole
0
Newbie Poster
Recommended Answers
Jump to Postperhaps you could run a different script that calls the scripts you want to run every 30 seconds, also if your on windows you could call os.system("cls") from within your script assuming you have imported the os module 'import os' this will clear the console for you. Im sure there …
Jump to Postdo something like this
import time, MyScript while True: MyScript.main() time.sleep(30)
and for MyScript.py
def main(): #your stuff here if __name__ == '__main__': main()
hope this helps
Chris
Jump to PostThis section is to do with importing, when a file is run on its own as an indervidual script the contents of this section is run. When the file is imported this section of code isn't run, here a short example to demonstrate this.
if __name__ == …
All 10 Replies
Freaky_Chris
299
Master Poster
frijole
0
Newbie Poster
Freaky_Chris
299
Master Poster
frijole
0
Newbie Poster
Freaky_Chris
299
Master Poster
frijole
0
Newbie Poster
ich1
0
Newbie Poster
Freaky_Chris
299
Master Poster
Freaky_Chris
299
Master Poster
frijole
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.