[我正在编写一个使用线程模块使用线程扫描网络的侦查工具,但是线程给我一个类型错误,并告诉我线程arg节中的每个字符都是单个参数
for host in nm.all_host():
threadx = threading.Thread(target=some_function, args=(host))
thread_list.appened(threadx)
thread.start()
TypeError:some_function()恰好接受1个参数(给定11个)给定的11表示网关地址,它包含11个字符,包括“。”。给定的13是指具有13个字符的客户地址,包括“。”
您正在传递字符串而不是元组,要传递元组,您应该在主机之后添加一个逗号,如下所示:
threadx = threading.Thread(target=some_function, args=(host,))