Διάβασε τον κώδικα προσεκτικά
import asyncio
import warnings
# Silence the "coroutine never awaited" warning that fires when
# the inner asyncio.run() raises before scheduling its coroutine.
warnings.simplefilter("ignore", RuntimeWarning)
async def inner():
return "inner-result"
async def outer():
loop = asyncio.get_running_loop()
print(f"loop_running:{loop.is_running()}")
try:
asyncio.run(inner())
print("nested:ok")
except RuntimeError as e:
print(f"nested:{e}")
result = await inner()
print(f"awaited:{result}")
asyncio.run(outer())
Τι θα εμφανίσει το πρόγραμμα; Γράψε εδώ: