'python how get returned value from async function

Python 3.9 How i get returned value from async function !


import asyncio


async def test(asd: bool):
    if asd is True:
        print("true")
        return True
    else:
        print("not true")
        return False

# simple function return
res = test(asd=0)    
print(f"{res=}, {type(res)=}")


Solution 1:[1]

Change p.rint to print. You send 0 asd = 0 its false then test return false and print "not true".

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nikola Cekic