You can use Python’s
eval() to evaluate Python expressions from a string-based or code-based input. This built-in function can be useful when you’re trying to evaluate Python expressions on the fly and you want to avoid the hassle of creating your own expressions evaluator from scratch.
In this course, you’ve learned how
eval() works and how to use it safely and effectively to evaluate arbitrary Python expressions.
You’re now able to:
- Use Python’s
eval() to dynamically evaluate basic Python expressions
- Run more complex statements like function calls, object creation, and attribute access using
- Minimize the security risks associated with the use of Python’s