错误代码:
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,)))
Original: https://www.cnblogs.com/yifengyu/p/16416287.html
Author: 平行时空的旅者
Title: python threading args参数报错must be an iterable, not int,解决方法
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/601400/
转载文章受原作者版权保护。转载请注明原作者出处!