PriceForecast/原油预测定时任务,请勿关闭.py

22 lines
673 B
Python
Raw Normal View History

2024-11-01 16:38:21 +08:00
# 定时执行cmd命令
2025-01-23 15:07:59 +08:00
import time
import os
2024-11-01 16:38:21 +08:00
while True:
try:
print(time.strftime('%H:%M'))
# 判断是不是工作日且 是1700 700 才执行
2025-01-23 15:07:59 +08:00
if time.strftime('%A') not in ['Saturday', 'Sunday'] and time.strftime('%H:%M') in ['07:50']:
# 要执行的命令
command = r"d:\yuanyouyuce\envs\predict\python main_yuanyou.py"
# 调用系统命令
os.system(command)
2024-11-01 16:38:21 +08:00
time.sleep(60)
except:
2024-11-08 11:18:40 +08:00
time.sleep(3600)
2025-01-23 15:07:59 +08:00
# 要执行的命令
command = r"d:\yuanyouyuce\envs\predict\python main_yuanyou.py"
# 调用系统命令
os.system(command)