PriceForecast/聚烯烃预测定时任务,请勿关闭.py
2025-02-13 17:32:49 +08:00

22 lines
674 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 定时执行cmd命令
import time
import os
while True:
try:
print(time.strftime('%H:%M'))
# 判断是不是工作日且 是1700 700 才执行
if time.strftime('%A') not in ['Saturday', 'Sunday'] and time.strftime('%H:%M') in ['16:10']:
# 要执行的命令
command = r"d:\yuanyouyuce\envs\predict\python main_yuanyou.py"
# 调用系统命令
os.system(command)
time.sleep(60)
except:
time.sleep(3600)
# 要执行的命令
command = r"d:\yuanyouyuce\envs\predict\python main_juxiting.py"
# 调用系统命令
os.system(command)