Answers for "new event loop asyncio"

1

new event loop asyncio

import asyncio

async def foo(loop):
    print('foo')
    loop.stop()

loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop) # <----
asyncio.ensure_future(foo(loop))
loop.run_forever()
Posted by: Guest on April-03-2021

Python Answers by Framework

Browse Popular Code Answers by Language