Haroon Haroon - 5 months ago 88
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()).