Code handled differently in my python interpreter


#1



Extracting Information


When I put the exact same code into my interpreter, I get an error message.

For example:

print datetime.now()
File "", line 1
print datetime.now()
^
SyntaxError: invalid syntax

However, when I do as it suggests...

print (datetime.now())
2016-12-07 11:55:54.902793

Is this because I'm on a different verison of python?


Replace this line with your code.


#2

Hi, @risteele ,

You are probably using Python 3.x, in which print is a function, rather than a command. The function requires the objects to be output to be specified within parentheses.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.