LoginSignup
0
1

More than 5 years have passed since last update.

Python2→3のprint利用時の注意

Last updated at Posted at 2017-06-16

初めてPythonを触り、お約束どおり"Hello, world!"したところエラーで進まず。
環境はPython3.6.1。たぶんこれあちこちでTips。
Python初学用のサイトを見ていたのだが

print "Hello, world!"

は [Missing parentheses in call to 'print'] になる。

原因としてはPython3ではprintは関数型で記述するように文法が変更されていたとのこと。。。

print("Hello, world!")

こちらは正常に通った。
ウェブの情報は記述されたタイミングなどの問題があるのでバージョンについては十分注意が必要なのは分かっているつもりだったが、やらかしてしまった(^^;

0
1
2

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
0
1