I'm receiving JSON objects of arbitrary shape.
And reform them into Lists mapped using __code__.co_varnames[:argc]
Ending up with a List looking like this ["param1=hello", "param2=world"]
in any order.
Now I want to link them to the specific parameters in the function as below.
But can't find how. In bash we have eval() I read something about using exec() but don't know how that should work.
def foo(param1:str, param2:str, *args) -> str:
return param1 + param2
list1 = ["param1=hello", "param2=world" ]
list2 = ["param2=world", "param1=hello" ]
# Want to do something like this for both lists
print(foo(*list1))
print(foo(*list2))
__code__oreval. Can you post an example of your JSON and your intended output?