{"id":2821,"date":"2023-01-06T07:30:17","date_gmt":"2023-01-06T07:30:17","guid":{"rendered":"https:\/\/learn.onemonth.com\/?p=2821"},"modified":"2023-01-06T13:58:04","modified_gmt":"2023-01-06T13:58:04","slug":"python-2-vs-python-3","status":"publish","type":"post","link":"https:\/\/learn.onemonth.com\/python-2-vs-python-3\/","title":{"rendered":"Python 2 vs Python 3: What&#8217;s the Difference?"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">Instagram recently celebrated their move from <a href=\"https:\/\/thenewstack.io\/instagram-makes-smooth-move-python-3\/\">Python 2 to Python 3<\/a>.\u00a0<\/span><span style=\"font-weight: 400;\">Yet many <a href=\"https:\/\/learn.onemonth.com\/10-famous-websites-built-using-python\/\">famous companies are still using Python 2<\/a>. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">Why? <\/span><span style=\"font-weight: 400;\">One word: compatibility. <\/span><\/p>\n<p>Python 3 is not &#8220;backwards-compatible&#8221; which means that if your company is using various Python 2 libraries they may no longer work after you upgrade.<\/p>\n<p><span style=\"font-weight: 400;\">Companies running code on Python 2 have to make a tough choice: they either have to find a replacement library that works with Python 3, or they are stuck with Python 2. <a href=\"https:\/\/blogs.dropbox.com\/tech\/2018\/09\/how-we-rolled-out-one-of-the-largest-python-3-migrations-ever\/\">Dropbox wrote a detailed report of the process that took them THREE YEARS to upgrade<\/a>.\u00a0<\/span><\/p>\n<blockquote><p>Python 3 adoption has long been a subject of debate in the Python community. This is still somewhat true, though it\u2019s now reached <a href=\"http:\/\/py3readiness.org\/\">widespread support<\/a>, with some very popular projects such as Django dropping Python 2 support entirely.<\/p><\/blockquote>\n<p><span style=\"font-weight: 400;\">You read that right, it took Dropbox three years to completed upgrade from Python 2 to Python 3 \u2014 and for gods sakes, Guido Van Rossum (the inventor of Python) works at Dropbox!<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Python 3 is more than 10 years old! Yet, many companies are still using Python 2. So which version of the language should you learn?\u00a0<\/span><span style=\"font-weight: 400;\">In this post I&#8217;ll break down the differences between Python 2 and Python 3. If you don&#8217;t want to read the post my advice:\u00a0<\/span><\/p>\n<h2><strong>Why is Python so Popular?<\/strong><\/h2>\n<ul>\n<li><strong>Intuitiveness<\/strong><b>. <\/b><span style=\"font-weight: 400;\">The syntax (or \u201cgrammar\u201d of Python, so to speak) is easy to understand.<\/span><\/li>\n<li><b>Maturity. <\/b><span style=\"font-weight: 400;\">Python is a proven language with powerful capabilities allowing you to code just about anything you can dream up.<\/span><\/li>\n<li><b>In-demand. <\/b><span style=\"font-weight: 400;\">Python developers are regularly hired by a host of companies throughout the world.<\/span><\/li>\n<li><b>Remote-friendly. <\/b><span style=\"font-weight: 400;\">Coding ninjas and coding students alike merely require an internet connection to achieve their goals.<\/span><\/li>\n<li><strong>Python is the new Excel.<\/strong> The reason <a href=\"https:\/\/learn.onemonth.com\/mba-students-learn-to-code\/\">Python is being taught in business school<\/a> is because Python is like Excel on steroids. With Python financial analysts, CEOs, and data-driven marketers can leverage the power of Python to crunch big data.<\/li>\n<\/ul>\n<h2>Why are there two version of Python?<\/h2>\n<p><span style=\"font-weight: 400;\">Change has been afoot for some time in the land of Python, however. The Python Software Foundation,<\/span><a href=\"https:\/\/docs.python.org\/3\/faq\/general.html\"><span style=\"font-weight: 400;\"> an independent non-profit organization that holds the copyright on the software<\/span><\/a><span style=\"font-weight: 400;\">, released version 2.7 in 2010, while at the same time upgrading the codebase to various iterations of 3.x simultaneously. Over a number of years, companies and projects started migrating to Python 3 due to its various benefits.<\/span><\/p>\n<figure id=\"attachment_2841\" aria-describedby=\"caption-attachment-2841\" style=\"width: 720px\" class=\"wp-caption alignnone\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\"wp-image-2841 size-full\" src=\"https:\/\/i0.wp.com\/learn.onemonth.com\/wp-content\/uploads\/2019\/03\/montey-python.jpg?resize=720%2C405&#038;ssl=1\" alt=\"Where does the name Python come from? Python (the coding language) comes from Montey Python, not the snake\" width=\"720\" height=\"405\" srcset=\"https:\/\/i0.wp.com\/learn.onemonth.com\/wp-content\/uploads\/2019\/03\/montey-python.jpg?w=720&amp;ssl=1 720w, https:\/\/i0.wp.com\/learn.onemonth.com\/wp-content\/uploads\/2019\/03\/montey-python.jpg?resize=300%2C169&amp;ssl=1 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><figcaption id=\"caption-attachment-2841\" class=\"wp-caption-text\">Python is named after a famous 1970\u2019s comedy troupe.Not the snake.<\/figcaption><\/figure>\n<h2><strong>Why Choose Python 2?<\/strong><\/h2>\n<p><span style=\"font-weight: 400;\">One of the biggest reasons to stick with Python 2 is if you\u2019re interested in working with a large codebase that was written in Python 2. Moving a large application written in an older version of one language, or re-rewriting it in another language altogether, can be a massive undertaking.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">Another reason to stay in the land of Python 2 is if your code depends on a specific extension originally written for Python 2 that has not been updated. Most of them have been, but not all. It\u2019s up to you to decide if it\u2019s worthwhile to continue to work with older extensions (also called \u201cpackages\u201d).<\/span><\/p>\n<h2><span style=\"font-weight: 400;\">Why Choose Python 3?<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">To put it bluntly, <strong>Python 2 is legacy, Python 3 is the Future. <\/strong>If you are starting to learn to code \u2014 learn Python 3. <\/span><span style=\"font-weight: 400;\">Here are some additional reasons why you should learn Python 3:<\/span><\/p>\n<ul>\n<li style=\"font-weight: 400;\"><b>Legacy code. <\/b>After 2020, <span style=\"font-weight: 400;\">Python 2 will no longer be maintained.\u00a0<\/span><\/li>\n<li><b>Learn best-practices. <span style=\"font-weight: 400;\">Python 3 includes upgrades not available in Python 2.<\/span><\/b><\/li>\n<li><b>Write cleaner code. <span style=\"font-weight: 400;\">Python 3 has elegantly modified its structure to so that it takes fewer lines of code to perform an action.<\/span><\/b><\/li>\n<li><b>Avoid syntax confusion. <\/b><span style=\"font-weight: 400;\">Some small grammatical differences exist between the two versions, which can frustrate beginners.<\/span><\/li>\n<\/ul>\n<h2><span style=\"font-weight: 400;\">What are the Differences between Python 2 and Python 3?<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">One of the first lines of Python code you will write as a beginner will be to tell the computer to use the <\/span><b>print <\/b><span style=\"font-weight: 400;\">function to return the phrase \u201cHello world!\u201d<\/span><\/p>\n<p><strong>Python 2:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">Print \u201cHello world!\u201d<\/pre>\n<p><strong>Python 3:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">print(\u201cHello world!\u201d)<\/pre>\n<p><strong>Result: <span style=\"font-weight: 400;\">The computer returns the same thing, but you may find that code nested in parentheses is used much more often in Python 3. There are programmatic reasons for this as well: Python 3 is much easier to read.<\/span><\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">Hello world!<\/pre>\n<p><span style=\"font-weight: 400;\">If that sounds like a lot of parentheses to keep track of, never fear! At the beginning of your learning process you\u2019ll install a <\/span><a href=\"https:\/\/www.sublimetext.com\/\"><span style=\"font-weight: 400;\">text editor<\/span><\/a><span style=\"font-weight: 400;\"> that is specifically designed to highlight missing parentheses and other syntax errors \u2014\u00a0and even autofill many common things for you.<\/span><\/p>\n<h2><strong>Python Variables\u00a0<\/strong><\/h2>\n<p><span style=\"font-weight: 400;\">A second example involving a more extensive use of parentheses is replacing a returned line of prepared text with different variables. This is part of the operation that is happening when you sign up for an email newsletter, and they magically address it to you with your actual name. <\/span><\/p>\n<p><strong>Python 2:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">User20987 = \u201cChris Castiglione\u201d\r\nprint \u201cHi, %, hope you\u2019re having a great day today!\u201d % (User20987)\r\n<\/pre>\n<p><strong>Python 3:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">User20987 = \u201cChris Castiglione\u201d\r\nprint(\u201cHi {0}, hope you\u2019re having a great day today!\u201d).format(User20987))\r\n<\/pre>\n<h2><span style=\"font-weight: 400;\">Python Functions\u00a0<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Another major syntax difference is how the <\/span><span style=\"font-weight: 400;\">raw_input() <\/span><span style=\"font-weight: 400;\">function has changed. This is an extremely common function that takes information from various fields on a website (such as when you sign up for a new account and type in your email address). <\/span><\/p>\n<p><strong>Python 2:\u00a0<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">Field_1 = raw_input(\u201centered_value\u201d)<\/pre>\n<p><strong>Python 3:<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">Field_1 = input(\u201centered_value\u201d)<\/pre>\n<p><span style=\"font-weight: 400;\">This matters more than it appears, because it also has an effect on how the computer interprets the code. Python 2 will automatically \u201cevaluate\u201d the input, which can have unintended consequences if the user does not enter the kind of data the programmer is expecting. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">Let\u2019s assume that in the above example, the Python 2 programmer expected the user to enter a whole number, but instead the user made a typo and entered the mathematical operation \u201c7-2\u201d. That line of code would return the number 5, which would not be the desired outcome.<\/span><\/p>\n<p><span style=\"font-weight: 400;\">The Python 3 version will not evaluate the input by default. Instead of doing math, it will return a form of data called a \u201cstring\u201d, which in this case would be a copy of what the user entered: \u201c7-2\u201d. This approach allows you to more precisely define what kind of data you receive from the user.<\/span><\/p>\n<figure id=\"attachment_2826\" aria-describedby=\"caption-attachment-2826\" style=\"width: 471px\" class=\"wp-caption aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" class=\" wp-image-2826\" src=\"https:\/\/i0.wp.com\/learn.onemonth.com\/wp-content\/uploads\/2019\/03\/7408464122_8b316e46c9_k.jpg?resize=471%2C353&#038;ssl=1\" alt=\"\" width=\"471\" height=\"353\" srcset=\"https:\/\/i0.wp.com\/learn.onemonth.com\/wp-content\/uploads\/2019\/03\/7408464122_8b316e46c9_k.jpg?resize=300%2C225&amp;ssl=1 300w, https:\/\/i0.wp.com\/learn.onemonth.com\/wp-content\/uploads\/2019\/03\/7408464122_8b316e46c9_k.jpg?resize=768%2C576&amp;ssl=1 768w, https:\/\/i0.wp.com\/learn.onemonth.com\/wp-content\/uploads\/2019\/03\/7408464122_8b316e46c9_k.jpg?resize=1030%2C773&amp;ssl=1 1030w, https:\/\/i0.wp.com\/learn.onemonth.com\/wp-content\/uploads\/2019\/03\/7408464122_8b316e46c9_k.jpg?w=2048&amp;ssl=1 2048w\" sizes=\"auto, (max-width: 471px) 100vw, 471px\" \/><figcaption id=\"caption-attachment-2826\" class=\"wp-caption-text\"><a href=\"http:\/\/fortune.com\/2017\/06\/08\/elon-musk-tesla-monty-python\/\">Elon Musk himself claims that Teslas can play any Monty Python skit on command. <\/a>Huge Python fan.<\/figcaption><\/figure>\n<h2><span style=\"font-weight: 400;\">Why I Recommend Learning Python 3:\u00a0<\/span><\/h2>\n<p><span style=\"font-weight: 400;\">Python 2 vs 3 performance in terms of computing speed has been dramatically improved, but Python 3 also improves upon the already vast abilities of Python 2. <\/span><\/p>\n<p><span style=\"font-weight: 400;\">Here are some cool new things that you\u2019ll learn as you start out:<\/span><\/p>\n<ul>\n<li><b>Easier user input. <span style=\"font-weight: 400;\">A common early lesson is to take a user\u2019s typed-in data (the input syntax example used above, for instance) and pass it off to a simple script to create a list of information. Python 3 improves upon this process.<\/span><\/b><\/li>\n<li><b>Improved number management.<span style=\"font-weight: 400;\"> Python 3 includes some math-calculation improvements that are critical for many applications.<\/span><\/b><\/li>\n<li><strong>Popular add-ons are supported<\/strong>. <span style=\"font-weight: 400;\">You\u2019ll also learn the concept of extensions called \u201cmodules\u201d and \u201cpackages\u201d that are not included in the default Python 3 installation. As you grow, installing and using these will become part of your daily repertoire. Nearly all of the most popular packages have been Python 3-ready for years.<\/span><\/li>\n<li><strong>Unicode support<\/strong>.<span style=\"font-weight: 400;\"> Did you know that emojis are <\/span><a href=\"https:\/\/en.wikipedia.org\/wiki\/Unicode\"><span style=\"font-weight: 400;\">Unicode<\/span><\/a><span style=\"font-weight: 400;\"><span style=\"font-weight: 400;\"> characters? No emojis in Python 2! <\/span><\/span>\ud83d\ude09 \ud83d\ude0e \ud83d\ude03<\/li>\n<li><strong>And there&#8217;s more! <\/strong>Here are six things to know <a href=\"https:\/\/learn.onemonth.com\/6-things-to-know-before-you-learn-python\/\">before you learn Python.<\/a><\/li>\n<\/ul>\n<div class=\"mceTemp\"><\/div>\n<h2>How Do I Get Python 3 On My Computer?<\/h2>\n<p><span style=\"font-weight: 400;\">Many brand-new computers still come with Python 2.7 pre-installed by default, but it\u2019s worth it to learn how to install and use Python 3 on your own personal machine. <\/span><\/p>\n<p><a href=\"https:\/\/learn.onemonth.com\/6-things-to-know-before-you-learn-python\/\"><span style=\"font-weight: 400;\">One Month\u2019s Intro to Python<\/span><\/a><span style=\"font-weight: 400;\"> class will guide you through <\/span><a href=\"http:\/\/installpython.com\/\"><span style=\"font-weight: 400;\">installing Python 3<\/span><\/a><span style=\"font-weight: 400;\"> on your personal machine, as the process to do this varies between operating systems.<\/span><\/p>\n<div class=\"mceTemp\"><\/div>\n<h2><\/h2>\n","protected":false},"excerpt":{"rendered":"<p>Instagram recently celebrated their move from Python 2 to Python 3.\u00a0Yet many famous companies are still using Python 2. Why? One word: compatibility. Python 3 is not &#8220;backwards-compatible&#8221; which means that if your company is using various Python 2 libraries they may no longer work after you upgrade. Companies running code on Python 2 have [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":2841,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[219],"tags":[1741,1743,1755,1753,1751,1749,604,1745,1747],"class_list":["post-2821","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-code","tag-difference-between-python-2-and-3","tag-difference-python-2-vs-python-3","tag-install-python-2-or-python-3","tag-python-2-vs-3-examples","tag-python-2-vs-3-print","tag-python-2-vs-3-code-examples","tag-python-2-vs-python-3","tag-why-choose-python-3","tag-why-learn-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Python 2 vs Python 3: What&#039;s the Difference? - Learn to code in 30 Days!<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/learn.onemonth.com\/python-2-vs-python-3\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python 2 vs Python 3: What&#039;s the Difference? - Learn to code in 30 Days!\" \/>\n<meta property=\"og:description\" content=\"Instagram recently celebrated their move from Python 2 to Python 3.\u00a0Yet many famous companies are still using Python 2. Why? One word: compatibility. Python 3 is not &#8220;backwards-compatible&#8221; which means that if your company is using various Python 2 libraries they may no longer work after you upgrade. Companies running code on Python 2 have [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/learn.onemonth.com\/python-2-vs-python-3\/\" \/>\n<meta property=\"og:site_name\" content=\"Learn to code in 30 Days!\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/OneMonthEdu\/\" \/>\n<meta property=\"article:author\" content=\"http:\/\/www.facebook.com\/castiglione\" \/>\n<meta property=\"article:published_time\" content=\"2023-01-06T07:30:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-01-06T13:58:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/learn.onemonth.com\/wp-content\/uploads\/2019\/03\/montey-python.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"720\" \/>\n\t<meta property=\"og:image:height\" content=\"405\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Chris Castiglione\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@http:\/\/www.twitter.com\/castig\" \/>\n<meta name=\"twitter:site\" content=\"@onemonthedu\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Chris Castiglione\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/learn.onemonth.com\\\/python-2-vs-python-3\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/learn.onemonth.com\\\/python-2-vs-python-3\\\/\"},\"author\":{\"name\":\"Chris Castiglione\",\"@id\":\"https:\\\/\\\/learn.onemonth.com\\\/#\\\/schema\\\/person\\\/8dc1aca571379024e84218939bad4489\"},\"headline\":\"Python 2 vs Python 3: What&#8217;s the Difference?\",\"datePublished\":\"2023-01-06T07:30:17+00:00\",\"dateModified\":\"2023-01-06T13:58:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/learn.onemonth.com\\\/python-2-vs-python-3\\\/\"},\"wordCount\":1239,\"publisher\":{\"@id\":\"https:\\\/\\\/learn.onemonth.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/learn.onemonth.com\\\/python-2-vs-python-3\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/learn.onemonth.com\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/montey-python.jpg?fit=720%2C405&ssl=1\",\"keywords\":[\"Difference between Python 2 and 3\",\"Difference python 2 vs. python 3\",\"install python 2 or python 3\",\"python 2 vs 3 examples\",\"python 2 vs 3 print\",\"python 2 vs. 3 code examples\",\"Python 2 vs. Python 3\",\"why choose python 3\",\"why learn python\"],\"articleSection\":[\"Learn to Code\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/learn.onemonth.com\\\/python-2-vs-python-3\\\/\",\"url\":\"https:\\\/\\\/learn.onemonth.com\\\/python-2-vs-python-3\\\/\",\"name\":\"Python 2 vs Python 3: What's the Difference? - Learn to code in 30 Days!\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/learn.onemonth.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/learn.onemonth.com\\\/python-2-vs-python-3\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/learn.onemonth.com\\\/python-2-vs-python-3\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/learn.onemonth.com\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/montey-python.jpg?fit=720%2C405&ssl=1\",\"datePublished\":\"2023-01-06T07:30:17+00:00\",\"dateModified\":\"2023-01-06T13:58:04+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/learn.onemonth.com\\\/python-2-vs-python-3\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/learn.onemonth.com\\\/python-2-vs-python-3\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/learn.onemonth.com\\\/python-2-vs-python-3\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/learn.onemonth.com\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/montey-python.jpg?fit=720%2C405&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/learn.onemonth.com\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/montey-python.jpg?fit=720%2C405&ssl=1\",\"width\":720,\"height\":405,\"caption\":\"Python 2 vs. Python 3\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/learn.onemonth.com\\\/python-2-vs-python-3\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/learn.onemonth.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python 2 vs Python 3: What&#8217;s the Difference?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/learn.onemonth.com\\\/#website\",\"url\":\"https:\\\/\\\/learn.onemonth.com\\\/\",\"name\":\"Learn to code in 30 Days!\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/learn.onemonth.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/learn.onemonth.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/learn.onemonth.com\\\/#organization\",\"name\":\"One Month\",\"url\":\"https:\\\/\\\/learn.onemonth.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/learn.onemonth.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/i2.wp.com\\\/learn.onemonth.com\\\/wp-content\\\/uploads\\\/2017\\\/09\\\/Screen-Shot-2017-09-11-at-2.33.59-PM.png?fit=466%2C114&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i2.wp.com\\\/learn.onemonth.com\\\/wp-content\\\/uploads\\\/2017\\\/09\\\/Screen-Shot-2017-09-11-at-2.33.59-PM.png?fit=466%2C114&ssl=1\",\"width\":466,\"height\":114,\"caption\":\"One Month\"},\"image\":{\"@id\":\"https:\\\/\\\/learn.onemonth.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/OneMonthEdu\\\/\",\"https:\\\/\\\/x.com\\\/onemonthedu\",\"https:\\\/\\\/instagram.com\\\/onemonthedu\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/one-month-inc-\\\/\",\"http:\\\/\\\/youtube.com\\\/c\\\/onemonth\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/learn.onemonth.com\\\/#\\\/schema\\\/person\\\/8dc1aca571379024e84218939bad4489\",\"name\":\"Chris Castiglione\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8fe82d1d7e14e57ba0d345f2f59a32ed805d05f2a3cba7079453e7ba481f79b3?s=96&d=monsterid&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8fe82d1d7e14e57ba0d345f2f59a32ed805d05f2a3cba7079453e7ba481f79b3?s=96&d=monsterid&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8fe82d1d7e14e57ba0d345f2f59a32ed805d05f2a3cba7079453e7ba481f79b3?s=96&d=monsterid&r=g\",\"caption\":\"Chris Castiglione\"},\"description\":\"Co-founder of Console.xyz. Adjunct Prof at Columbia University Business School.\",\"sameAs\":[\"http:\\\/\\\/www.castig.org\",\"http:\\\/\\\/www.facebook.com\\\/castiglione\",\"https:\\\/\\\/x.com\\\/http:\\\/\\\/www.twitter.com\\\/castig\"],\"url\":\"https:\\\/\\\/learn.onemonth.com\\\/author\\\/chris\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Python 2 vs Python 3: What's the Difference? - Learn to code in 30 Days!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/learn.onemonth.com\/python-2-vs-python-3\/","og_locale":"en_US","og_type":"article","og_title":"Python 2 vs Python 3: What's the Difference? - Learn to code in 30 Days!","og_description":"Instagram recently celebrated their move from Python 2 to Python 3.\u00a0Yet many famous companies are still using Python 2. Why? One word: compatibility. Python 3 is not &#8220;backwards-compatible&#8221; which means that if your company is using various Python 2 libraries they may no longer work after you upgrade. Companies running code on Python 2 have [&hellip;]","og_url":"https:\/\/learn.onemonth.com\/python-2-vs-python-3\/","og_site_name":"Learn to code in 30 Days!","article_publisher":"https:\/\/www.facebook.com\/OneMonthEdu\/","article_author":"http:\/\/www.facebook.com\/castiglione","article_published_time":"2023-01-06T07:30:17+00:00","article_modified_time":"2023-01-06T13:58:04+00:00","og_image":[{"width":720,"height":405,"url":"https:\/\/learn.onemonth.com\/wp-content\/uploads\/2019\/03\/montey-python.jpg","type":"image\/jpeg"}],"author":"Chris Castiglione","twitter_card":"summary_large_image","twitter_creator":"@http:\/\/www.twitter.com\/castig","twitter_site":"@onemonthedu","twitter_misc":{"Written by":"Chris Castiglione","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/learn.onemonth.com\/python-2-vs-python-3\/#article","isPartOf":{"@id":"https:\/\/learn.onemonth.com\/python-2-vs-python-3\/"},"author":{"name":"Chris Castiglione","@id":"https:\/\/learn.onemonth.com\/#\/schema\/person\/8dc1aca571379024e84218939bad4489"},"headline":"Python 2 vs Python 3: What&#8217;s the Difference?","datePublished":"2023-01-06T07:30:17+00:00","dateModified":"2023-01-06T13:58:04+00:00","mainEntityOfPage":{"@id":"https:\/\/learn.onemonth.com\/python-2-vs-python-3\/"},"wordCount":1239,"publisher":{"@id":"https:\/\/learn.onemonth.com\/#organization"},"image":{"@id":"https:\/\/learn.onemonth.com\/python-2-vs-python-3\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/learn.onemonth.com\/wp-content\/uploads\/2019\/03\/montey-python.jpg?fit=720%2C405&ssl=1","keywords":["Difference between Python 2 and 3","Difference python 2 vs. python 3","install python 2 or python 3","python 2 vs 3 examples","python 2 vs 3 print","python 2 vs. 3 code examples","Python 2 vs. Python 3","why choose python 3","why learn python"],"articleSection":["Learn to Code"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/learn.onemonth.com\/python-2-vs-python-3\/","url":"https:\/\/learn.onemonth.com\/python-2-vs-python-3\/","name":"Python 2 vs Python 3: What's the Difference? - Learn to code in 30 Days!","isPartOf":{"@id":"https:\/\/learn.onemonth.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/learn.onemonth.com\/python-2-vs-python-3\/#primaryimage"},"image":{"@id":"https:\/\/learn.onemonth.com\/python-2-vs-python-3\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/learn.onemonth.com\/wp-content\/uploads\/2019\/03\/montey-python.jpg?fit=720%2C405&ssl=1","datePublished":"2023-01-06T07:30:17+00:00","dateModified":"2023-01-06T13:58:04+00:00","breadcrumb":{"@id":"https:\/\/learn.onemonth.com\/python-2-vs-python-3\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/learn.onemonth.com\/python-2-vs-python-3\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/learn.onemonth.com\/python-2-vs-python-3\/#primaryimage","url":"https:\/\/i0.wp.com\/learn.onemonth.com\/wp-content\/uploads\/2019\/03\/montey-python.jpg?fit=720%2C405&ssl=1","contentUrl":"https:\/\/i0.wp.com\/learn.onemonth.com\/wp-content\/uploads\/2019\/03\/montey-python.jpg?fit=720%2C405&ssl=1","width":720,"height":405,"caption":"Python 2 vs. Python 3"},{"@type":"BreadcrumbList","@id":"https:\/\/learn.onemonth.com\/python-2-vs-python-3\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/learn.onemonth.com\/"},{"@type":"ListItem","position":2,"name":"Python 2 vs Python 3: What&#8217;s the Difference?"}]},{"@type":"WebSite","@id":"https:\/\/learn.onemonth.com\/#website","url":"https:\/\/learn.onemonth.com\/","name":"Learn to code in 30 Days!","description":"","publisher":{"@id":"https:\/\/learn.onemonth.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/learn.onemonth.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/learn.onemonth.com\/#organization","name":"One Month","url":"https:\/\/learn.onemonth.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/learn.onemonth.com\/#\/schema\/logo\/image\/","url":"https:\/\/i2.wp.com\/learn.onemonth.com\/wp-content\/uploads\/2017\/09\/Screen-Shot-2017-09-11-at-2.33.59-PM.png?fit=466%2C114&ssl=1","contentUrl":"https:\/\/i2.wp.com\/learn.onemonth.com\/wp-content\/uploads\/2017\/09\/Screen-Shot-2017-09-11-at-2.33.59-PM.png?fit=466%2C114&ssl=1","width":466,"height":114,"caption":"One Month"},"image":{"@id":"https:\/\/learn.onemonth.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/OneMonthEdu\/","https:\/\/x.com\/onemonthedu","https:\/\/instagram.com\/onemonthedu\/","https:\/\/www.linkedin.com\/company\/one-month-inc-\/","http:\/\/youtube.com\/c\/onemonth"]},{"@type":"Person","@id":"https:\/\/learn.onemonth.com\/#\/schema\/person\/8dc1aca571379024e84218939bad4489","name":"Chris Castiglione","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/8fe82d1d7e14e57ba0d345f2f59a32ed805d05f2a3cba7079453e7ba481f79b3?s=96&d=monsterid&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/8fe82d1d7e14e57ba0d345f2f59a32ed805d05f2a3cba7079453e7ba481f79b3?s=96&d=monsterid&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8fe82d1d7e14e57ba0d345f2f59a32ed805d05f2a3cba7079453e7ba481f79b3?s=96&d=monsterid&r=g","caption":"Chris Castiglione"},"description":"Co-founder of Console.xyz. Adjunct Prof at Columbia University Business School.","sameAs":["http:\/\/www.castig.org","http:\/\/www.facebook.com\/castiglione","https:\/\/x.com\/http:\/\/www.twitter.com\/castig"],"url":"https:\/\/learn.onemonth.com\/author\/chris\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/learn.onemonth.com\/wp-content\/uploads\/2019\/03\/montey-python.jpg?fit=720%2C405&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/learn.onemonth.com\/wp-json\/wp\/v2\/posts\/2821","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/learn.onemonth.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/learn.onemonth.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/learn.onemonth.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/learn.onemonth.com\/wp-json\/wp\/v2\/comments?post=2821"}],"version-history":[{"count":29,"href":"https:\/\/learn.onemonth.com\/wp-json\/wp\/v2\/posts\/2821\/revisions"}],"predecessor-version":[{"id":3242,"href":"https:\/\/learn.onemonth.com\/wp-json\/wp\/v2\/posts\/2821\/revisions\/3242"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/learn.onemonth.com\/wp-json\/wp\/v2\/media\/2841"}],"wp:attachment":[{"href":"https:\/\/learn.onemonth.com\/wp-json\/wp\/v2\/media?parent=2821"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/learn.onemonth.com\/wp-json\/wp\/v2\/categories?post=2821"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/learn.onemonth.com\/wp-json\/wp\/v2\/tags?post=2821"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}