Python summary: versions

Now two Python versions are being used: the 2.x and 3.x ones.

$ python --version
Python 2.7.6
$ python3 --version
Python 3.4.0

Recommend: use the latest stable version.


Here is a list of the most noticeable changes between them:

2.x print "Hello" # Display a text
3.x print("Hello")
2.x print "Hello", # Supress newline
3.x print("Hello", end=" ")
2.x raw_input("How old? ") # Ask to the user
3.x input("How old? ")
2.x # -*- coding: utf-8 -*- # For using UTF-8; py2 works with ASCII by default
3.x # Python 3 works with UTF-8 by default


More information:

Liked it? Share it! ;)

Be First to Comment

Leave a Reply