[python] Hello World in Python

I tried running a python script:

print "Hello, World!" 

And I get this error:

  File "hello.py", line 1
    print "Hello, World!"
                        ^
SyntaxError: invalid syntax

What is going on?

This question is related to python python-3.x

The answer is


In python 3.x. you use

print("Hello, World")

In Python 2.x. you use

print "Hello, World!"

Unfortunately the xkcd comic isn't completely up to date anymore.

https://imgs.xkcd.com/comics/python.png

Since Python 3.0 you have to write:

print("Hello world!")

And someone still has to write that antigravity library :(