python - Python线程参数问题
问题描述
我已经尝试了大约半个小时,但似乎无法理解我在这里做错了什么。工作代码:
import threading
from time import sleep
def printX():
threading.Timer(5.0, printX).start()
print("five")
printX()
while True:
print("1")
sleep(1)
这可行,但是我需要能够动态分配打印语句以及延迟。所需代码:
import threading
from time import sleep
def printX(time, message):
threading.Timer(int(time), printX).start()
print(str(message)
printX(time, message)
while True:
print("Rest of the program continues")
sleep(1)
提前感谢您的帮助:)。
解决方案
推荐阅读
- sql - SQL 活动验证但不更新目标数据扩展
- c# - 用于从 3 个表中获取数据的 LINQ 查询
- javascript - 知道设备方向是否与坐标一致的逻辑
- google-cloud-platform - GCP vm 上的 red5 流服务器使用 red5pro-installer 应用程序无法使用“示例”流
- sql - 聚合数组列中不同元素的单个数组,不包括 NULL
- python - 如何在 RaspberyPi 上通过 Python 从 MINEW Eddystone BLE 信标读取额外信息?
- linux - 如何找到转换表的基地址以进行初始查找?
- javascript - 为什么数组对象拥有长度属性?
- html - 如何在不使用负边距的情况下实现这种突出的图像布局?
- r - 为什么 rlang::quo_is_missing(quo(NA)) 评估为 FALSE?