Skip to content Skip to sidebar Skip to footer

Interpreting A Python Function From Json Data

I am trying to determine the equivalence of two simple functions passed to python via json like so: PHP: $data = array('2*x', 'x*2'); $result = shell_exec('python /path/check.py '

Solution 1:

You need to convert the strings into SymPy expressions:

sympify(answer) == sympify(response)

Post a Comment for "Interpreting A Python Function From Json Data"