tags:

views:

997

answers:

5

I'm new to python and am currently lost as to why print is giving a syntax here. Hoping someone might be able to point me in the right direction. Thanks

Python 3.0.1 (r301:69561, Feb 13 2009, 20:04:18) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> print "hello World"
  File "<stdin>", line 1
    print "hello World"
                      ^
SyntaxError: invalid syntax
>>> exit()

Windows path is correctly pointing to the python directory.

+14  A: 

In Python 3.0, print became a function. You need to include parenthesis now.

print("Hello World")

http://docs.python.org/3.0/whatsnew/3.0.html#print-is-a-function

Unknown
+5  A: 

It looks like you're using Python 3.0, in which print has turned into a callable function rather than a statment.

print('Hello world!')

http://docs.python.org/3.0/whatsnew/3.0.html#print-is-a-function

brianz
+2  A: 

In Python 3.0, print is a regular function that requires ():

print("Hello world")
Ayman Hourieh
+2  A: 

It looks like you're using Python 3. In Python 3, print has been changed to a method instead of a statement. Try this:

print("hello World")
TwentyMiles
+2  A: 

In python 3, it's print("something") , not print "something"

Reef