This is my code:
async def fun1():
result=False
#Some time-consuming operations...
return result
async def fun2():
result=False
#Some time-consuming operations...
return result
if fun1() or fun2():
print("Success")
The if block runs all conditions by order, but I want run them simultaneously and wait until any of theme returns True. I know asyncio.wait(tasks,return_when=asyncio.FIRST_COMPLETED) but I don't know how to use it for my purpose.
Aucun commentaire:
Enregistrer un commentaire