비동기 (3) 썸네일형 리스트형 Python 3, asyncio와 놀아보기 - 스크랩 https://tech.ssut.me/python-3-play-with-asyncio/ Python 3, asyncio와 놀아보기 Explicit and implicit concurrency in Python. cooperative multitasking in Python. Asyncio (PEP-3156) Asyncio는 Python 3.4에 새로 추가된 라이브러리로 이름 그대로 파이썬에서 비동기 IO를 통해 조금 더 효율적으로 동시에 tech.ssut.me asyncio 예제 코드 coro1 함수는 3초마다 1씩 증가하는 값 출력하는 함수 coro2 함수는 input 값이 들어오면 입력한 값 출력하는 함수 import asyncio as aio async def coro1(): i = 1 while True: print(i) i = i+1 await aio.sleep(3) async def coro2(loop): while True: msg = await loop.run_in_executor(None, input, ": ") print('->', msg) async def main(): loop = aio.get_event_loop() task1 = loop.create_task(coro1()) task2 = loop.create_task(coro2(loop)) await task.. asyncio.sleep within asyncio UDP server stackoverflow.com/questions/36285065/asyncio-sleep-from-within-a-udp-server-not-working asyncio.sleep from within a UDP server not working I'm playing with asyncio UDP server example and would like to have a sleep from within the datagram_received method. import asyncio class EchoServerProtocol: def connection_made(self, transpo... stackoverflow.com def datagram_received(self, data, addr): async.. 이전 1 다음