Files
Python-for-Geeks/Chapter7/asyncio/asyncio1.py
T
2021-03-31 09:22:38 +04:00

14 lines
285 B
Python

#asyncio1.py to build a basic coroutine
import asyncio
import time
async def say(delay, msg):
await asyncio.sleep(delay)
print(msg)
print("Started at ", time.strftime("%X"))
asyncio.run(say(1,"Good"))
asyncio.run(say(2, "Morning"))
print("Stopped at ", time.strftime("%X"))