print list(prolog.query(code))
^
SyntaxError: invalid syntax
can anyone tell me what does this syntax error mean?
I tried to install but it doesn't work.
print list(prolog.query(code))
^
SyntaxError: invalid syntax
can anyone tell me what does this syntax error mean?
I tried to install but it doesn't work.
check which python version you are using.
The code shown in question is valid until python 2.7, but not in Python 3 onward.
valid for Python 3:
print(list(prolog.query(code)))
(note the additional parenthesis like any function for print
).
And as general advice, as noticed in comments, a syntax error marked at a line could be confusing and caused by a problem on the line before. Comment the line where you have the error and check.
This code is not valid in python 3.x
But this is valid in 2.x
print(list(prolog.query(code))
(recommended)Check this article
.