Browse Source
bpo-33649: Add a hello world example to asyncio.rst (GH-9374)
pull/9376/head
Yury Selivanov
8 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
13 additions and
0 deletions
-
Doc/library/asyncio.rst
|
|
|
@ -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. |
|
|
|
|
|
|
|
|