python - 如何在 Python 中进行调度作业以弹出列表中的元素?
问题描述
我想string
为每个给定的时间间隔弹出下面列表的每个元素。
我在最后尝试了以下代码,但每次它只获取最后一个元素。
import schedule
import time
def job():
#print("I'm working...")
string = [1, 2, 3, 4]
print (string.pop())
schedule.every(0.1).minutes.do(job)
schedule.every().hour.do(job)
schedule.every().day.at("10:30").do(job)
while 1:
schedule.run_pending()
time.sleep(1)
我得到的结果是4
4
4
4
. 我期待4
3
2
1
。
解决方案
推荐阅读
- web-applications - iOS Safari Mobile Web-App 独立模式文件-浏览对话框在任务切换后消失
- php - 从数组中删除重叠的时间间隔
- android - 有没有办法让用户在 Android 上使用 Firebase Auth 在本机代码和 WebView 之间登录?
- javascript - 使用任何浏览器跟踪 SVG 图像元素上的像素点击
- javascript - CKEditor 5 显示视频元素,但插入 div 的纯 HTML 不显示该元素
- c# - Windows 更新挂钩
- java - Spring Boot 2.2.0 中的两个数据源,两个存储库
- node.js - JaCoCo 可以用于 NodeJS 代码覆盖吗?
- r - 用另一个数据框替换数据框中的两个单元格
- angular - Angular 7 打印服务