【问题标题】:i have python script in spyder and i want it to run daily at 4pm我在 spyder 中有 python 脚本,我希望它每天下午 4 点运行
【发布时间】:2019-07-23 10:47:03
【问题描述】:

我在 spyder 中将 python 脚本保存为blocking_oth,我想每天下午 4 点自动运行这个脚本

我已经试过了-

import schedule
import time
import os

def job():
    os.system('Blocking_oth')


schedule.every().day.at("16:05").do(job)

while True:
    schedule.run_pending()
    time.sleep(1)

但这给了我错误:

"NameError: 名称 'Blocking_oth' 未定义"

【问题讨论】:

标签: python spyder


【解决方案1】:

也许你应该这样做

os.startfile(path[, operation])

os.system 用于运行 cmd 命令。

【讨论】:

    猜你喜欢
    • 2023-04-09
    • 1970-01-01
    • 2020-01-26
    • 1970-01-01
    • 2011-07-15
    • 2014-05-16
    • 2015-09-17
    • 2020-05-16
    • 2015-01-29
    相关资源
    最近更新 更多