|
12345678910111213 |
- import asyncio
-
- @asyncio.coroutine
- def test(i):
- print('test_1', i)
- r = yield from asyncio.sleep(1)
- print('test_2', i)
-
- if __name__ == '__main__':
- loop = asyncio.get_event_loop()
- tasks = [test(i) for i in range(3)]
- loop.run_until_complete(asyncio.wait(tasks))
- loop.close()
|