Safe expression parser in Python

前端 未结 5 1141
小鲜肉
小鲜肉 2020-12-01 16:23

How can I allow users to execute mathematical expressions in a safe way? Do I need to write a full parser?

Is there something like ast.literal_eval(), but for expres

5条回答
  •  余生分开走
    2020-12-01 16:58

    What sort of expressions do you want? Variable assignment? Function evaluation?

    SymPy aims to become a full-fledged Python CAS.

提交回复
热议问题