[英]how can i get the results of Prolog by searching a query through python
This is the program which i have tried: 这是我尝试过的程序:
from pyswip import Prolog
prolog = Prolog()
prolog.assertz("father(michael,john)")
prolog.assertz("father(michael,gina)")
print list(prolog.query("father(michael,X)"))
Output which i am getting: 我得到的输出:
Process finished with exit code 139 (interrupted by signal 11: SIGSEGV) 进程以退出代码139结束(由信号11中断:SIGSEGV)
Expected Output: 预期产出:
X=gina X =吉娜
你应该使用
print(list(prolog.query("father(michael,X)")))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.