1

次のエラーが表示されます。

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

この Python コードでは:

#!/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]
        ]

なにが問題ですか?

編集:私はPython 3.3を使用しています

4

1 に答える 1

6

これは次のようになります。

print("....")

Python 3 以降でprintは、関数であり、特殊なケース ステートメントではありません。

于 2013-03-16T12:12:31.963 に答える