看起来我可以通过两种方式使用python进行快速爬虫:
带有套接字的线程池
非块套接字选择,asyncore等。
我认为这里的线程没有真正需要,而解决方案#2更好。
哪个更好,为什么?
答案 0 :(得分:3)
Twisted通常比asyncore更受欢迎。它是can also work with thread pools。
的异步I / O框架在Python中,您应该首选异步IO到线程,因为GIL会导致threads are a second class citizen in its canonical implementation (CPython)。