Python3.6 AttributeError: module 'asyncio' has no attribute 'run'

前端 未结 2 1850
小蘑菇
小蘑菇 2020-12-08 09:38

I tried to read https://hackernoon.com/asynchronous-python-45df84b82434. It\'s about asynchronous python and I tried the code from this, but I\'m getting a weird Error. The

2条回答
  •  北海茫月
    2020-12-08 09:56

    asyncio.run is a Python 3.7 addition. In 3.5-3.6, your example is roughly equivalent to:

    import asyncio
    
    futures = [...]
    loop = asyncio.get_event_loop()
    loop.run_until_complete(asyncio.wait(futures))
    

提交回复
热议问题