Premiers pas avec python-asyncio
Installation ou configuration
Pour installer asyncio :
pip install asyncio
Notez que python asyncio nécessite Python 3.3 ou version ultérieure.
Ce module est devenu une partie de la bibliothèque standard Python depuis Python 3.4.
Exemple simple - Impression de ‘Hello World’ avec asyncio
import asyncio
async def hello_world():
print('Hello World')
loop = asyncio.get_event_loop()
loop.run_until_complete(hello_world())
loop.close()