429

2 分钟

#eval

说明:执行表达式并返回结果。

def eval(source:str|codeobject, /, globals:dict=None, locals:mapping=None): ''' 执行表达式并返回结果 :param source: Python 表达式 :param globals : 全局命名空间 :param locals : 局部命名空间 :return: 表达式的求值结果 '''

示例:

print(eval('1 + 1')) x = 233 print(eval('x + 1'))

>>> Establishing WebAssembly Runtime.

>>> Standby.

Powered by Shift.

创建于 2025/5/9

更新于 2025/5/11