1

I'm getting the following error:

  File "foo.py", line 6
    print "This implementation requires the numpy module."
                                                         ^
SyntaxError: invalid syntax

In this Python code:

#!/usr/bin/python

try:
    import numpy
except:
    print "This implementation requires the numpy module."
    exit(0)

###############################################################################

if __name__ == "__main__":
    R = [
         [1,2,3],
         [4,5,6]
        ]

What is wrong?

EDIT: I use Python 3.3

AndyG
  • 39,700
  • 8
  • 109
  • 143
gurehbgui
  • 14,236
  • 32
  • 106
  • 178

1 Answers1

6

This should be:

print("....")

Starting with python 3, print is a function, not a special case statement.

viraptor
  • 33,322
  • 10
  • 107
  • 191