【发布时间】:2018-11-02 11:20:01
【问题描述】:
我知道我们可以 import modules 并将 Python 代码嵌入 C++ 和 evaluate it。但是我怎样才能使用像print 或open 这样的内置函数呢?这些功能当然不是模块。评估嵌入的 open 语句只会给我以下错误:
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'open' is not defined
卡住了。请帮帮我。
【问题讨论】:
-
你可以
import builtins,但不知道这是否有帮助......