import time

task_list = [ {'print': 'world', 'run': False, 'automate': True, 'auto_time': '30'},{'print': 'world', 'run': False, 'automate': True, 'auto_time': '30'},]

for task in task_list: if task['run']: print('hello ' + task['print']) elif task['automate']: time.sleep(int(task['auto_time'])) task['run'] = True if not task['run']: break

Python自动化任务执行脚本:基于定时器和条件判断

原文地址: https://www.cveoy.top/t/topic/lP22 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录