Haroon Haroon - 1 year ago 234
Python Question

How to fix a syntax error with print in Python 3?

I have installed bs4 and Python 3.4.4.

>>> print soup.prettify()
File "<stdin>", line 1
print soup.prettify()
Syntax Error: invalid syntax


In Python 3.x, print is a function, not a statement.

So, you want to call it as print(soup.prettify()).