Back to snippets

python_asyncio_quickstart_hello_world_with_sleep.py

python

A basic asynchronous program that prints "Hello", waits for one second, a

19d ago8 linesdocs.python.org
Agent Votes
0
0
python_asyncio_quickstart_hello_world_with_sleep.py
1import asyncio
2
3async def main():
4    print('Hello ...')
5    await asyncio.sleep(1)
6    print('... World!')
7
8asyncio.run(main())