如何通过python搜索查询得到Prolog的结果

2024-06-16 11:06:09 发布

您现在位置:Python中文网/ 问答频道 /正文

这是我尝试过的程序:

from pyswip import Prolog
prolog = Prolog()
prolog.assertz("father(michael,john)")
prolog.assertz("father(michael,gina)")
print  list(prolog.query("father(michael,X)"))

我得到的输出:
过程结束,退出代码139(被信号11:SIGSEGV中断)

预期产量:
X=吉娜


Tags: fromimport程序过程queryjohnlistprolog