python threading args参数报错must be an iterable, not int,解决方法

错误代码:

thread.append(threading.Thread(target=as_same_time, args=(0)))

 

 

分析:

因为as_same_time方法只需要一个参数,,args是通过元组打包的数据,所以只有一个参数后面要加上【,】如果不加逗号,0两边的左右括号会被当作参数传入

正确写法为:

thread.append(threading.Thread(target=as_same_time, args=(0,)))

 

posted @   平行时空的旅者  阅读(685)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· 一文读懂知识蒸馏
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
点击右上角即可分享
微信分享提示