QP School

Full Version: Async/Await in Python 3
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
import asyncio

async def async_example():
    print("Start")
    await asyncio.sleep(2)  # Asynchronous sleep for 2 seconds
    print("End")

# Create an event loop and run the async function
asyncio.run(async_example())