python模块之sniffio

时间:2024-10-19 12:34:02

嗅探python用了哪个异步库

from sniffio import current_async_library
import trio
import asyncio async def print_library():
library = current_async_library()
print("This is:", library) # Prints "This is trio"
trio.run(print_library) # Prints "This is asyncio"
asyncio.run(print_library())