python中eval函数的用法十分的灵活,这里主要介绍一下它的原理和一些使用的场合。
下面是从python的官方文档中的解释:
The arguments are a string and optional globals and locals. If provided, globals must be a dictionary. If provided, locals can be any mapping object.
The expression argument is parsed and evaluated as a Python [removed]technica