程序运行结果:
PS C:\Users\123\Desktop> & C:/Users/123/AppData/Local/Programs/Python/Python39/python.exe c:/Users/123/Desktop/python/爬虫
/高性能爬虫/aiohttp.py
1
Traceback (most recent call last):
File "C:\Users\123\AppData\Local\Programs\Python\Python39\lib\asyncio\windows_events.py", line 434, in select
self._poll(timeout)
RuntimeError: <_overlapped.Overlapped object at 0x000001E2167FC660> still has pending operation at deallocation, the process may crash
Traceback (most recent call last):
File "C:\Users\123\AppData\Local\Programs\Python\Python39\lib\asyncio\windows_events.py", line 434, in select
self._poll(timeout)
RuntimeError: <_overlapped.Overlapped object at 0x000001E2167FC660> still has pending operation at deallocation, the process may crash
import asyncio
async def f():
print(1)
asyncio.run(f())
你这个性能好高啊,哈哈哈
想用协程,就得创建协程对象,io请求就用await等待