LoginSignup
44
23

More than 5 years have passed since last update.

SyntaxError: Missing parentheses in call to 'print' と言われました

Posted at

Python で print を使ったら動かなくて困りました。

環境

環境は python3 です。

python --version
Python 3.5.1 :: Anaconda 4.0.0 (x86_64)

print が使えません

  File "<stdin>", line 1
    print "hoge"
               ^
SyntaxError: Missing parentheses in call to 'print'

python3 から print の書き方が変わった

何だこれおかしいと思ったら、python3 から書き方が変わったのを知りませんでした😓

print "Hello world"  # python 2.x

Is now

print("Hello world")   # python 3.x

print("hoge") に変更したら動きました😳

参考

44
23
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
44
23