我想在异步函数中调用exec并执行类似下面的代码(这是无效的):
import asyncio async def f(): await exec('x = 1\n' 'await asyncio.sleep(x)')
更确切地说,我希望能够在exec中运行的代码中等待未来.
怎么能实现这一目标?
python exec python-3.x python-asyncio
exec ×1
python ×1
python-3.x ×1
python-asyncio ×1