【问题标题】:How to trigger python script automatically in a specific date?如何在特定日期自动触发 python 脚本?
【发布时间】:2020-10-19 09:55:01
【问题描述】:

我有一个看起来像这样的文件: 东风: 月份产品开始_日期结束_日期更新_on 0 一月 饮料 01/01/2020 01/31/2020 02/06/2020 2 月 1 日 饮料 02/01/2020 02/29/2020 03/06/2020 3 月 2 日 饮料 03/01/2020 03/31/2020 04/06/2020 4 月 3 日 饮料 04/01/2020 04/30/2020 05/06/2020 5 月 4 日饮料 05/01/2020 05/31/2020 06/06/2020

如何在特定日期触发我的 python 脚本? 例如,我需要在每个月 6 日更新我的文件,我的 python 脚本应该在那天自动运行以获取输出 df,如下所示,其他月份以此类推。

输出 df : 月份产品开始_日期结束_日期更新_on 0 一月 饮料 01/01/2020 01/31/2020 02/06/2020 2 月 1 日 饮料 02/01/2020 02/29/2020 03/06/2020 3 月 2 日 饮料 03/01/2020 03/31/2020 04/06/2020 4 月 3 日 饮料 04/01/2020 04/30/2020 05/06/2020 5 月 4 日饮料 05/01/2020 05/31/2020 06/06/2020 6 月 5 日饮料 06/01/2020 06/30/2020 07/06/2020

【问题讨论】:

标签: python python-3.x pandas


【解决方案1】:

我很确定最简单的解决方案是守护进程。根据您的操作系统,您可能需要在 Linux 上使用 cron 或 Windows 上的任务调度程序等守护程序,可能会有一些类比,但我熟悉的那些。这些工具不仅可以根据时间标准安排某些任务。

https://opensource.com/article/17/11/how-use-cron-linux https://www.windowscentral.com/how-create-automated-task-using-task-scheduler-windows-10

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-10-12
    • 1970-01-01
    • 1970-01-01
    • 2013-03-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多