- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
以下代码传递了一个列表 (varbinds),并且工作正常。
t1 = threading.Thread(target = Main2_TrapToTxtDb, args = (varBinds,))
现在我需要同时传递另一个变量 - vString。
请帮忙写一个简单的代码。
最佳答案
args
参数是一个元组,允许您将许多参数传递给目标。
t1 = threading.Thread(target=Main2_TrapToTxtDb, args=(varBinds, otherVariable))
这已记录在案 here :
threading.Thread(group=None, target=None, name=None, args=(),kwargs={})
This constructor should always be called with keyword arguments. Arguments are:
group should be None; reserved for future extension when a ThreadGroup class is implemented.
target is the callable object to be invoked by the run() method. Defaults to None, meaning nothing is called.
name is the thread name. By default, a unique name is constructed of the form “Thread-N” where N is a small decimal number.
args is the argument tuple for the target invocation. Defaults to ().
kwargs is a dictionary of keyword arguments for the target invocation. Defaults to {}.
关于python - 在 Python 线程中传递多个参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40581649/
我是一名优秀的程序员,十分优秀!