python多线程,执行第10个时退出了,为啥啊?

ning100_csdn ning100_csdn 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
import threading
import time
def tpppppp(qqq):
print (threading.current_thread().name,threading.activeCount(),qqq)
time.sleep(1)
pppp=0
print (type(pppp))
print (threading.current_thread().getName())
while 1:
if threading.activeCount() <= 4:
pppp += 1
tt=threading.Thread(target = tpppppp,args = (str(pppp)))
tt.setDaemon(True)
tt.start()
tt.join()

=====输出如下,第10个就退出了=============
MainThread
Thread-1 2 1
Thread-2 2 2
Thread-3 2 3
Thread-4 2 4
Thread-5 2 5
Thread-6 2 6
Thread-7 2 7
Thread-8 2 8
Thread-9 2 9
Exception in thread Thread-10:
Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
TypeError: tpppppp() takes 1 positional argument but 2 were given

Exception in thread Thread-11:
Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
TypeError: tpppppp() takes 1 positional argument but 2 were given
...全文

相关推荐

评论 3
收藏 已收藏
分享
返回顶部
ning100_csdn
脚本语言 37,737 成员 34,208 内容