Fetch the repository succeeded.
This action will force synchronization from pish7/stdpython, which will overwrite any changes that you have made since you forked the repository, and can not be recovered!!!
Synchronous operation will process in the background and will refresh the page when finishing processing. Please be patient.
# exec 执行一系列 Python 语句
# 提供一个字典作为 exec 的存储空间,exec中创建的变量在存储在 namespace 中
namespace = {}
exec(
"""
x = 3
y = 4
z = x * y
""",
namespace,
)
print(namespace["z"]) # 12
# eval
# 计算用字符串表示的Python表达式的值
a = 2
b = 3
c = eval("a * b") # 计算并返回 python 表达式的值
print(c) # 6
namespace = {"a": 2, "b": 3} # 命令空间也可用于传值
c = eval("a * b", namespace)
print(c) # 6
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。