简体   繁体   English

如何安排 Python 代码每天运行多次,仅使用 python 代码

[英]How to schedule Python Code Run Multiple Time Every Day, With using only python code

I have a CSV file in which all time mentioned, and I want to run my python code file every day on time which is given in CSV file.我有一个 CSV 文件,其中一直提到,我想每天按时运行我的 python 代码文件,该文件在 CSV 文件中给出。 在此处输入图像描述

I saw some code on the Schedule library, but I don't understand how should I write that code.我在 Schedule 库上看到了一些代码,但我不明白我应该如何编写该代码。 as well as, I have to write schedule code in that same file that I want to run, or should I create new file and write schedule code there and give that file link that I want to run?以及,我必须在我想要运行的同一个文件中编写计划代码,或者我应该创建新文件并在那里编写计划代码并提供我想要运行的文件链接?

and my file name is - send_mesaage.ipynb我的文件名是 - send_mesaage.ipynb

From geeksforgeeks i found this:geeksforgeeks我发现了这个:

import sched
import time

# instance is created
scheduler = sched.scheduler(time.time,
                            time.sleep)

# function to print time
# and name of the event
def print_event(name):
    print('EVENT:', time.time(), name)

# printing starting time
print ('START:', time.time())

# first event with delay of
# 1 second
e1 = scheduler.enter(1, 1,
                    print_event, ('1 st', ))

# second event with delay of
# 2 seconds
e1 = scheduler.enter(2, 1,
                    print_event, (' 2nd', ))

# executing the events
scheduler.run()

How this works: Its simple,这是如何工作的:它很简单,
event_schedule.enter(Sleep_Time, Priority, Function_to_run)
and event_schedule.run() starts the event_schedule.enter() do you haveevent_schedule.run()启动event_schedule.enter()你有吗

If you are using Kaggle, it maybe helpful.如果您使用的是 Kaggle,可能会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何安排代码在每天的特定时间运行? - How to schedule code to run at a specific time every day? 如何使用Python日程安排创建作业任务,使其仅在白天从6AM到10PM的时间内每3分钟运行一次 - how to create a job task to run every 3 minutes during only at day time from 6AM to 10PM using python schedule 如何安排脚本每天运行 Python - How to schedule a script to run every day for Python 如何安排python脚本在特定时间每天运行? (Windows计划除外) - How can I Schedule python script to run every day at specific time ? (except Windows schedule) Python每天在定义的时间运行一段代码 - Python to run a piece of code at a defined time every day 将作业安排为仅在 Python 中的特定日期每 5 分钟运行一次 - Schedule a job to run every 5 mins only on a particular day in python 如何安排生产 python 脚本以触发 function 在每天的指定时间运行 - How to schedule a production python script to trigger a function to run at a specified time every Day 如何使用 Apschedulers 安排 Python 代码每天运行? - How to Schedule Python Code To Run Daily Using Apschedulers? Python计划:每天安排多次 - Python Schedule: Scheduling multiple times per day every day Python:如何在每次运行 function 时增加代码计数 - Python: How to increase count for a code every time a function is run
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM