Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python3
- # encoding=utf-8
- import asyncio
- from utility import hello, time_me
- from run_ import run, create_task
- """
- filename: basic8.py
- description: gather
- License: GPL V2
- Author: 天使de眼睛
- 除特别声明,所有代码均是 python3.6 在 iOS 环境下编写测试。
- """
- asyncio.run = run
- asyncio.create_task = create_task
- async def gather_tasks():
- return await asyncio.gather(hello(2, 'Kitty'), hello(1, 'Doggy'))
- @time_me
- def main():
- kitty, doggy = asyncio.run(gather_tasks())
- print(f'kitty returns: {kitty}')
- print(f'doggy returns: {doggy}')
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement