File size: 285 Bytes
1c6c5d7
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import asyncio


def async_tasks(*tasks):

    async def gather(*t):
        t = [await _ for _ in t]
        return await asyncio.gather(*t)

    loop = asyncio.new_event_loop()
    results = loop.run_until_complete(gather(*tasks))
    loop.stop()
    loop.close()
    return results