擅长:python、mysql、java
<p>我不能让MP正常工作,所以我做了这个,而它似乎工作得很好。但MP可能是解决这个问题的更好方法</p>
<pre><code> #Just keeps track of the threads
threads = []
#Generates a thread for whatever variable thread_count = N
for thread in range(thread_count):
#function retrns a list of pages stored in page_listS, this ensures each thread gets a unique list.
page_list = page_lists[thread]
#actual fucntion for each thread to work
t = threading.Thread(target=pull_data, args=(account,thread))
#puts all threads into a list
threads.append(t)
#runs all the treads up
t.start()
#After all threads are complete back to the main thread.. technically this is not needed
for t in threads:
t.join()
</code></pre>
<p>我也不明白为什么你会“需要”。join()很好的答案是:
<a href="https://stackoverflow.com/questions/15085348/what-is-the-use-of-join-in-python-threading">what is the use of join() in python threading</a></p>