<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: PyLenin</title>
    <description>The latest articles on DEV Community by PyLenin (@pylenin).</description>
    <link>https://dev.to/pylenin</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F688647%2F01ba0589-4b2a-4906-bbfd-15a7d118755c.png</url>
      <title>DEV Community: PyLenin</title>
      <link>https://dev.to/pylenin</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pylenin"/>
    <language>en</language>
    <item>
      <title>Migration to Python 3 is still very slow</title>
      <dc:creator>PyLenin</dc:creator>
      <pubDate>Wed, 25 Aug 2021 06:53:52 +0000</pubDate>
      <link>https://dev.to/pylenin/migration-to-python-3-is-still-very-slow-239</link>
      <guid>https://dev.to/pylenin/migration-to-python-3-is-still-very-slow-239</guid>
      <description>&lt;p&gt;I was just going through Stack Overflow and I realized that people are still asking questions about Python 2.7. Surely, a lot of them are about ways to migrate to Python 3, but still, there were a lot of questions being asked on functionality.&lt;/p&gt;

&lt;p&gt;That got me curious and I started researching PyPI package downloads for Python 2.7. I came across &lt;a href="https://packaging.python.org/guides/analyzing-pypi-package-downloads/"&gt;this page&lt;/a&gt; and saw how one can look into the number of installations of various libraries for various Python versions.&lt;/p&gt;

&lt;p&gt;I specifically used this query to find the number of library downloads per Python version.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;SELECT&lt;/span&gt;
  &lt;span class="n"&gt;REGEXP_EXTRACT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;details&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;python&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="nv"&gt;"[0-9]+&lt;/span&gt;&lt;span class="se"&gt;\.&lt;/span&gt;&lt;span class="nv"&gt;[0-9]+"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;python_version&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="k"&gt;COUNT&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;AS&lt;/span&gt; &lt;span class="n"&gt;num_downloads&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="nv"&gt;`bigquery-public-data.pypi.file_downloads`&lt;/span&gt;
&lt;span class="k"&gt;WHERE&lt;/span&gt;
  &lt;span class="c1"&gt;-- Only query the last 6 months of history&lt;/span&gt;
  &lt;span class="nb"&gt;DATE&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;timestamp&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;BETWEEN&lt;/span&gt; &lt;span class="n"&gt;DATE_TRUNC&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;DATE_SUB&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;CURRENT_DATE&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;INTERVAL&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt; &lt;span class="k"&gt;MONTH&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="k"&gt;MONTH&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;AND&lt;/span&gt; &lt;span class="k"&gt;CURRENT_DATE&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;GROUP&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="nv"&gt;`python_version`&lt;/span&gt;
&lt;span class="k"&gt;ORDER&lt;/span&gt; &lt;span class="k"&gt;BY&lt;/span&gt; &lt;span class="nv"&gt;`num_downloads`&lt;/span&gt; &lt;span class="k"&gt;DESC&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The results have totally surprised me. There have been more than &lt;strong&gt;5.5 billion package downloads for Python 2.7 just in the last 6 months&lt;/strong&gt; and it is &lt;strong&gt;more than the number of installations for Python 3.9!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0VULKZpU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/utl2qn02mvcgcizgmfva.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0VULKZpU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/utl2qn02mvcgcizgmfva.PNG" alt="Number of package installations categorized by Python versions"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This shows that people are not really migrating to Python 3, even with all the support down for Python 2!!&lt;/p&gt;

&lt;p&gt;I mean, it both surprises me and confuses me! If anyone reading this is also one of the above, I highly recommend you moving to Python 3 as soon as possible. You are missing out on a lot of advantages. &lt;/p&gt;

&lt;p&gt;Just for you, I wrote this &lt;a href="https://www.pylenin.com/blogs/10-benefits-of-switching-to-python-3/"&gt;blog&lt;/a&gt; &lt;strong&gt;to showcase the advantages of Python 3 over Python 2&lt;/strong&gt;. If you are interested, please take a look. And if it helps you to move on to Python 3, I would be very happy!&lt;/p&gt;

</description>
      <category>python</category>
    </item>
    <item>
      <title>Python program to print over the same line</title>
      <dc:creator>PyLenin</dc:creator>
      <pubDate>Mon, 23 Aug 2021 09:28:10 +0000</pubDate>
      <link>https://dev.to/pylenin/python-program-to-print-over-the-same-line-h13</link>
      <guid>https://dev.to/pylenin/python-program-to-print-over-the-same-line-h13</guid>
      <description>&lt;p&gt;Let's say you have a bunch of print statements.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print("Pylenin")
print("loves")
print("Python")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The output will look like below.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Pylenin
loves
Python
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, &lt;strong&gt;if you want to print over and over the same line in Python&lt;/strong&gt;, you have to use the &lt;strong&gt;carriage return &lt;code&gt;\r&lt;/code&gt; symbol with the &lt;code&gt;end&lt;/code&gt; argument.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print("Pylenin", end="\r")
print("loves", end="\r")
print("Python")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Pythonn
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Even though the first 2 print statements are executed, the carriage return makes the next &lt;strong&gt;stdout&lt;/strong&gt; line start at the beginning of the current line.&lt;/p&gt;

&lt;p&gt;Also, carriage return will only replace the number of characters contained in the print statement. That is the reason, you have an extra &lt;strong&gt;n&lt;/strong&gt; at the end.&lt;/p&gt;

&lt;p&gt;This is one of the applications of print in Python. If you are curious to know more, &lt;a href="https://www.pylenin.com/blogs/python-print/"&gt;check out my blog&lt;/a&gt; on the various aspects of printing in Python.&lt;/p&gt;

</description>
      <category>python</category>
      <category>beginners</category>
    </item>
    <item>
      <title>What if you forget to add Python to the PATH variable?
</title>
      <dc:creator>PyLenin</dc:creator>
      <pubDate>Fri, 20 Aug 2021 04:35:24 +0000</pubDate>
      <link>https://dev.to/pylenin/what-if-you-forget-to-add-python-to-the-path-variable-21ij</link>
      <guid>https://dev.to/pylenin/what-if-you-forget-to-add-python-to-the-path-variable-21ij</guid>
      <description>&lt;p&gt;If you forget to add Python to the PATH, you won't be able to run Python in your command line from any other directory.&lt;/p&gt;

&lt;p&gt;You will get a message saying,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;'python' is not recognized as an internal or external command.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is because Windows is trying to search for Python in its PATH variable and is unable to find it.&lt;/p&gt;

&lt;p&gt;Here is a &lt;strong&gt;step-by-step instruction&lt;/strong&gt; to add Python to the PATH variable in Windows 10.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Copy the directory to which Python is being installed.&lt;/li&gt;
&lt;li&gt;Search for &lt;strong&gt;System Properties&lt;/strong&gt; in the Search Bar.&lt;/li&gt;
&lt;li&gt;Click on the &lt;strong&gt;"Environment Variables" button&lt;/strong&gt; in System Properties.&lt;/li&gt;
&lt;li&gt;Click on the &lt;strong&gt;"Path"&lt;/strong&gt; variable and then click on "Edit".&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Now here's the deal. Pay Attention!&lt;/strong&gt;
Paste the directory path from Step 1 &lt;strong&gt;at the top of the list.&lt;/strong&gt; You can use the "Move up" button to get it to the top.
Now click on "Ok".&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now you can open up your command line and run python. &lt;strong&gt;The Python interactive shell will open up.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Here is a little extra tip! *&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Add the Scripts folder to the PATH variable too.&lt;/strong&gt; This is the folder where all your libraries will be installed.&lt;/p&gt;

&lt;p&gt;If the instructions are not clear enough for you, you can also check out the &lt;strong&gt;&lt;a href="https://www.pylenin.com/blogs/why-add-python-to-path/"&gt;visual guide&lt;/a&gt;&lt;/strong&gt; containing images of every step, on my blog for achieving the above objective.&lt;/p&gt;

&lt;p&gt;Good luck and let me know!&lt;/p&gt;

</description>
      <category>python</category>
      <category>beginners</category>
    </item>
    <item>
      <title>How I got into Python programming?</title>
      <dc:creator>PyLenin</dc:creator>
      <pubDate>Wed, 18 Aug 2021 04:29:40 +0000</pubDate>
      <link>https://dev.to/pylenin/how-i-got-into-python-programming-4i1f</link>
      <guid>https://dev.to/pylenin/how-i-got-into-python-programming-4i1f</guid>
      <description>&lt;p&gt;My first encounter with Python happened because of a &lt;strong&gt;small lie&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;During my application to an internship that required me to build the control system of robots using Python, I lied to my recruiter about already possessing beginner-level programming skills in python. &lt;/p&gt;

&lt;p&gt;Thankfully, he didn't ask me anything else and accepted me for the internship program. But since that day, I have religiously practiced Python every day in my life, so that I wouldn't have to lie to anyone else! &lt;/p&gt;

&lt;p&gt;In my beginner days, I did the whole dance to learn Python. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;I did a lot of free courses on the internet. &lt;/li&gt;
&lt;li&gt;I solved every problem I could find on any Python topic again and again. &lt;strong&gt;And then again!&lt;/strong&gt; &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Initially, I only did it to do excel at my thesis. But eventually, I fell in love with this simple language. &lt;/p&gt;

&lt;p&gt;So much so that I started applying for Python programming jobs even before my Masters in Transportation Engineering got over and happily accepted the job offer when I got one. &lt;/p&gt;

&lt;h2&gt;
  
  
  Websites I followed for learning
&lt;/h2&gt;

&lt;p&gt;I would like to provide the list of websites, that were of great help when I began programming. &lt;/p&gt;

&lt;p&gt;2015 was not the year when there tons of Medium or Dev posts on learning Python. So, finding something useful was actually tricky.&lt;/p&gt;

&lt;p&gt;I was a student and therefore, &lt;strong&gt;could not afford any paid courses&lt;/strong&gt;. So I had to stick to the free websites that were available at that time.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Stack Overflow&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href="https://www.coursera.org/specializations/python"&gt;Python for everybody course on Coursera&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Shout out to &lt;strong&gt;Charles Severance&lt;/strong&gt; for helping me land my first job.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Learn Python the Hard Way&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  How learning Python has helped me in my career?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Learning Python changed my life!&lt;/strong&gt; Believe me, its an understatement!&lt;/p&gt;

&lt;p&gt;It opened up so many doors for me in various different fields. Infact, I was the &lt;strong&gt;only student in my batch&lt;/strong&gt; to have a student job as a Python developer and getting paid 18 Euros an hour. Sweet, isn't it? &lt;/p&gt;

&lt;p&gt;Infact, I have told my full story of how I became a Python developer without any formal training in Computer Science &lt;a href="https://youtu.be/ahT2CZ9Se-s"&gt;in this video&lt;/a&gt;. If you are interested to hear an Indian guy with an accent, speak about his life experience, do check it out.&lt;/p&gt;

&lt;p&gt;For those of you confused about your career decisions, I would definitely recommend that &lt;strong&gt;Python is a great programming language to learn&lt;/strong&gt;. It provides a lot of job opportunities and doesn't have a huge learning curve. Check out my blog on &lt;a href="https://www.pylenin.com/blogs/5-reasons-to-learn-python/"&gt;5 career-driven decisions to learn Python in 2021&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>python</category>
      <category>beginners</category>
      <category>hobby</category>
    </item>
  </channel>
</rss>
