擅长:python、mysql、java
<p>myThread类的构造函数必须是:</p>
<pre><code>class myThread (threading.Thread):
def __init__(self, threadID, name, counter):
threading.Thread.__init__(self, name=name)
self.threadID = threadID
self.name = name
self.counter = counter
def run(self):
print("[+] Starting " + self.name)
connect(self.name, self.counter, eachThread, self.threadID)
</code></pre>
<p>请注意<code>threading.Thread.__init__(self, name=name)</code>后的<code>threading.Thread.__init__(self, name=name)</code>。在尝试设置名称之前,必须调用基类的构造函数。在</p>