import asyncio
async def fetch_data(url):
# await 挂起,让出 CPU
response = await aiohttp.get(url)
# I/O 完成后继续执行
return response.json()
async def main():
# 并发执行
tasks = [fetch_data(url) for url in urls]
results = await asyncio.gather(*tasks)