We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4d962f5 commit 902d623Copy full SHA for 902d623
1 file changed
pachong1.py
@@ -89,10 +89,20 @@ def test(page):
89
90
91
if __name__ == '__main__':
92
+ threads = []
93
for page in range(1, 5):
94
95
# 启动多线程,每个线程分别抓取不同的页
- threading.Thread(target=test, args=(page,)).start()
96
+ # threading.Thread(target=test, args=(page,)).start()
97
+ t = threading.Thread(target=test, args=(page,))
98
+ threads.append(t)
99
100
# 单进程很慢,一页接着一页抓取
101
# test(page)
102
+
103
+ for i in threads:
104
+ i.start()
105
106
107
+ i.join()
108
+ print 'All is Done'
0 commit comments