Python SyntaxError when using end argument with print function

python

Solution

Or, to use the print function like you want in Python 2:

>>> from __future__ import print_function

That will need to be at the top of your Python program though because of the way the `__future__` module works.

Problem

I don't know why i get the error because i have done exactly as the book says ``` >>> os.getcwd() 'C:\\Users\\expoperialed\\Desktop\\Pyt…' >>> data = open('sketch.txt') >>> print(data.readline(),end="") SyntaxError: invalid syntax ```

Original source