python | asyncio协程写法
贴个代码方便以后用:
if __name__ == '__main__':
client = Pybilidanmu()
tasks = [
client.enter_room(),
]
loop = asyncio.get_event_loop()
try:
loop.run_until_complete(asyncio.wait(tasks))
except KeyboardInterrupt:
for tasks in asyncio.Task.all_tasks():
task.cancel()
loop.run_forever()
loop.close()
原创文章,作者:1402239773,如若转载,请注明出处:https://blog.ytso.com/273913.html