I tried running prolog with python 3.8.2.

I saw a voice somewhere on the net saying "pyswip is convenient, but it doesn't support python 3 ~ crying".

I wrote this article with the intention of reporting that "** python3.8.2 worked fine with pyswip **".

It's a slapstick, but unless you're a prophet, you can't say that it works with python3. Even if it works with python3.8.2, there is no logical guarantee that it will work with python3.8.3 or later. </ sub> </ sub>

1. pip install pyswip 2. Execute the following code

from pyswip import Prolog
p = Prolog()
p.assertz("father(michael, john)")
p.assertz("father(michael, gina)")
for s in p.query("father(X,Y)"):
    print(s["X"], "is the father of", s["Y"])
  1. Get standard output as follows
micheal is the father of john
micheal is the father of gina

Reference: "Examples" at https://github.com/yuce/pyswip

Recommended Posts

I tried running prolog with python 3.8.2.
I tried fp-growth with python
I tried scraping with Python
I tried gRPC with Python
I tried scraping with python
I tried running faiss with python, Go, Rust
I tried running Deep Floor Plan with Python 3.6.10.
I tried web scraping with python.
I tried Grumpy (Go running Python).
I tried SMTP communication with Python
I tried running Movidius NCS with python of Raspberry Pi3
I tried scraping Yahoo News with Python
I tried non-photorealistic rendering with Python + opencv
I tried a functional language with Python
I tried recursion with Python ② (Fibonacci sequence)
#I tried something like Vlookup with Python # 2
I tried running pymc
I tried Python> autopep8
I tried running TensorFlow
I tried "smoothing" the image with Python + OpenCV
I tried hundreds of millions of SQLite with python
I tried L-Chika with Raspberry Pi 4 (Python edition)
I tried Jacobian and partial differential with python
I tried to get CloudWatch data with Python
I tried using mecab with python2.7, ruby2.3, php7
I tried to output LLVM IR with Python
I tried "binarizing" the image with Python + OpenCV
I tried to automate sushi making with python
I tried playing mahjong with Python (single mahjong edition)
I tried running alembic, a Python migration tool
I tried sending an email with SendGrid + Python
I tried Learning-to-Rank with Elasticsearch!
I made blackjack with python!
I tried clustering with PyCaret
I tried Python C extension
[Python] I tried using OpenPose
I made wordcloud with Python.
I tried to implement Minesweeper on terminal with python
I tried to get started with blender python script_Part 01
I tried to touch the CSV file with Python
I tried to draw a route map with Python
[OpenCV / Python] I tried image analysis of cells with OpenCV
I tried running python etc. from a bat file
I tried to solve the soma cube with python
I tried to get started with blender python script_Part 02
I tried to implement an artificial perceptron with python
I tried to automatically generate a password with Python3
Mayungo's Python Learning Episode 1: I tried printing with print
[Python] I tried running a local server using flask
I tried to solve the problem with Python Vol.1
I tried to analyze J League data with Python
I tried "morphology conversion" of images with Python + OpenCV
I tried hitting the API with echonest's python client
I tried to solve AOJ's number theory with Python
I tried to find the entropy of the image with python
I tried "gamma correction" of the image with Python + OpenCV
I tried to simulate how the infection spreads with Python
Robot running with Arduino and python
I tried using the Python library from Ruby with PyCall
I tried to make various "dummy data" with Python faker
I tried various methods to send Japanese mail with Python