import asyncio
import nest_asyncio
def loof_test():
test_list = [1,2,3,4,5]
nest_asyncio.apply()
loop = asyncio.get_event_loop()
loop_list = loop.run_until_cimplete(futures(test_list))
for _ in loop_list:
print(_)
@asyncio.coroutine
async def futures(test_list):
futures = [asyncio.ensure_future(async_main(t, ) for t in test_list]
result = await asyncio.gather(*futures)
return result
@asyncio.coroutine
async def async_main(t):
return t
'Python > Python__works' 카테고리의 다른 글
socket으로 서버 이름 확인하기 (0) | 2020.02.13 |
---|---|
application.yml 에서 db 접속 정보 읽어오기 (0) | 2020.02.13 |
asyncio (0) | 2019.11.19 |
파이참 터미널에서 pip upgrade해도 버젼 안바뀌거나 오류날때 (0) | 2019.11.13 |
selenium tutorial (0) | 2019.11.08 |