bpo-33649: Add a hello world example to asyncio.rst (GH-9374)
This commit is contained in:
parent
188ebfa475
commit
3085534c39
|
@ -6,6 +6,19 @@
|
|||
|
||||
--------------
|
||||
|
||||
.. sidebar:: Hello World!
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import asyncio
|
||||
|
||||
async def main():
|
||||
print('Hello ...')
|
||||
await asyncio.sleep(1)
|
||||
print('... World!')
|
||||
|
||||
asyncio.run(main())
|
||||
|
||||
asyncio is a library to write **concurrent** code using
|
||||
**async/await** syntax.
|
||||
|
||||
|
|
Loading…
Reference in New Issue