Python Notebook automatically starts automatically

I have a script in a laptop browser that does some real-time data analysis that I would like to run periodically once every few seconds / minutes, instead of having to do Ctrl + Enter all the time.

Is there any way to achieve this? Do I need additional plugins, and which ones

+4
source share
2 answers

One way is to make your cell a function. In another cell, just call time.sleep () in the appropriate loop. You can also check if some external resource exists if you do not want to loop a priori a known finite number of times.

+1
source

:

def periodic_work(interval):
    while True:
        #change this to the function you want to call, or paste in the code you want to run
        your_function()
        #interval should be an integer, the number of seconds to wait
        time.sleep(interval)

, periodic_work(60) - IPython, , Kernal . / , "" ( "" ) . , , periodic_work.

+1

Source: https://habr.com/ru/post/1544206/


All Articles