Evaluating Arbitrary Strings As Python Expressions
We'll cover the following
This is the final piece of the puzzle (or rather, the final piece of the puzzle solver). After all that fancy string manipulation, we’re left with a string like '9567 + 1085 == 10652'
. But that’s a string, and what good is a string? Enter eval()
, the universal Python evaluation tool.
Get hands-on with 1200+ tech skills courses.