How to run tasks concurrently in asyncio?
问题 I'm trying to learn how to run tasks concurrently using Python's asyncio module. In the following code, I've got a mock "web crawler" for an example. Basically, I am trying to make it where there are a max of two active fetch() requests happening at any given time, and I want process() to be called during the sleep() period. import asyncio class Crawler(): urlq = ['http://www.google.com', 'http://www.yahoo.com', 'http://www.cnn.com', 'http://www.gamespot.com', 'http://www.facebook.com', 'http