Python3 vs Python2

On Jul 15, 2016 by digvijayb |

Python is general-purpose dynamic programming language desgined by Guido van Rossum. Which support multiple programming paradigm like object oriented, imperative, functional and others but it considered as one of the main stream functional programming language as it extensive use in functional world. If you are new to python you find people working of different version of python which parallely maintanied. As now 15 july 2016 there are two different stable vision of python are avaliable. 3.5.2 and 2.7.12. 3.5.2 is not at all compatible with 2.7.12 there are even minor syntax differences. So this we will focus on find the differences between the two favour of python.

Python 2.x vs. Python 3.x

Python comes in two basic flavors these days – Python 2.x (currently 2.7) and Python 3.x (currently 3.3). This is an important difference – some code written for one won’t run on the other. However, most code is interchangeable. Here are some of the key differences:

Python 2.x Python 3.x
print “hello” (print is a keyword) print(“hello”) (print is a function)
except Exception, e: # OR except Exception as e except Exception as e: # ONLY
Naming of Libraries and APIs are frequently inconsistent with PEP 8 Improved (but still imperfect) consistency with PEP 8 guidelines
Strings and unicode Strings are all unicode and bytes type is for unencoded 8 bit values

There is a utility called that you can use to convert Python 2.x code to 3.x, while the ‘-3’ command line switch in 2.x enables additional deprecation warnings for cases the automated converter cannot handle. Third party tools like python-modernize and the ‘six’ support package make it easy to target the large common subset of the two variants for libraries and applications which support both 2.x and 3.x.

Below are the few which show comprehensive review difference between Python2 and Python3

Share :

Subscribe & Social

Subscribe to this blog via RSS.

Recent Posts


Java 14

Python 2

Wordpress 1

Ops 3

Shared 3

Angular 1

Web 1

Popular Tags

Java (14) Python (2) Wordpress (1) Ops (3) Angular (1) Web (1)


DGStack is web blog by digvijay bhakuni. This blog is about computer programming tips and trick. And some short tutorial and gettings started post about the framework, libriay, api and much more. The blog target mostly open source stuff like java, j2ee, nodeJs, angularJs, spring, struts, mongodb, mean, etc


This website claims no credit for any images posted on this site unless otherwise noted. Images on this blog are copyright to its respectful owners. If there is an image appearing on this blog that belongs to you and do not wish for it appear on this site, please E-mail with a link to said image and it will be promptly removed. And the information is best of my knowledge one can always write comment or mail regarding information is this blog.