<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

  <title>Real Python</title>
  <link href="https://realpython.com/atom.xml" rel="self"/>
  <link href="https://realpython.com/"/>
  <updated>2025-01-07T14:00:00+00:00</updated>
  <id>https://realpython.com/</id>
  <author>
    <name>Real Python</name>
  </author>

  
    <entry>
      <title>Ways to Start Interacting With Python</title>
      <id>https://realpython.com/courses/interactive-python/</id>
      <link href="https://realpython.com/courses/interactive-python/"/>
      <updated>2025-01-07T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll explore the various ways of interacting with Python. You&#x27;ll learn about the REPL for quick testing and running scripts, as well as how to work with different IDEs, and Python&#x27;s IDLE.</summary>
      <content type="html">
        &lt;p&gt;There are multiple ways of interacting with Python, and each can be useful for different scenarios. You can quickly explore functionality in Python&amp;rsquo;s interactive mode using the &lt;a href=&quot;https://realpython.com/python-repl/&quot;&gt;built-in Read-Eval-Print Loop (REPL)&lt;/a&gt;, or you can write larger applications to a script file using an &lt;a href=&quot;https://realpython.com/python-ides-code-editors-guide/&quot;&gt;editor or Integrated Development Environment (IDE)&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use Python &lt;strong&gt;interactively&lt;/strong&gt; by typing code directly into the interpreter&lt;/li&gt;
&lt;li&gt;Execute code contained in a &lt;strong&gt;script file&lt;/strong&gt; from the &lt;strong&gt;command line&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Work within a Python &lt;strong&gt;Integrated Development Environment (IDE)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Assess additional options, such as &lt;strong&gt;Thonny&lt;/strong&gt; and Python&amp;rsquo;s &lt;strong&gt;IDLE&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Iterators and Iterables in Python: Run Efficient Iterations</title>
      <id>https://realpython.com/python-iterators-iterables/</id>
      <link href="https://realpython.com/python-iterators-iterables/"/>
      <updated>2025-01-06T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn what iterators and iterables are in Python. You&#x27;ll learn how they differ and when to use them in your code. You&#x27;ll also learn how to create your own iterators and iterables to make data processing more efficient.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Understanding iterators and iterables in Python is crucial for running efficient iterations. Iterators control loops, allowing you to traverse arbitrary data containers one item at a time. Iterables, on the other hand, provide the data that you want to iterate over. By mastering these concepts, you can create robust code that handles data efficiently, even when working with large datasets or infinite data streams.&lt;/p&gt;
&lt;p&gt;This tutorial covers creating iterators using the &lt;strong&gt;iterator protocol&lt;/strong&gt;, differentiating iterators from iterables, and using &lt;strong&gt;generator functions&lt;/strong&gt; and the &lt;code&gt;yield&lt;/code&gt; statement to create &lt;strong&gt;generator iterators&lt;/strong&gt;. You’ll also learn how to build &lt;strong&gt;custom iterables&lt;/strong&gt; using various techniques, including the &lt;strong&gt;iterable protocol&lt;/strong&gt;, and how to write &lt;strong&gt;asynchronous iterators&lt;/strong&gt; using the &lt;code&gt;asyncio&lt;/code&gt; module.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this tutorial, you’ll understand that:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Python iterators&lt;/strong&gt; are objects with &lt;strong&gt;&lt;code&gt;.__iter__()&lt;/code&gt; and &lt;code&gt;.__next__()&lt;/code&gt;&lt;/strong&gt; methods.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Iterables&lt;/strong&gt; are objects that can return an iterator using the &lt;strong&gt;&lt;code&gt;.__iter__()&lt;/code&gt;&lt;/strong&gt; method.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Generator functions&lt;/strong&gt; use the &lt;strong&gt;&lt;code&gt;yield&lt;/code&gt; statement&lt;/strong&gt; to create &lt;strong&gt;generator iterators&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Asynchronous iterators&lt;/strong&gt; use &lt;strong&gt;&lt;code&gt;.__aiter__()&lt;/code&gt; and &lt;code&gt;.__anext__()&lt;/code&gt;&lt;/strong&gt; for async operations.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Iterators&lt;/strong&gt; are memory-efficient and can handle &lt;strong&gt;infinite data streams&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Before diving deeper into these topics, you should be familiar with some core concepts like &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;loops and iteration&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/&quot;&gt;object-oriented programming&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/inheritance-composition-python/&quot;&gt;inheritance&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-classes/#special-methods-and-protocols&quot;&gt;special methods&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/async-io-python/&quot;&gt;asynchronous programming&lt;/a&gt; in Python.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Free Sample Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-iterators-iterables-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-iterators-iterables-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free sample code&lt;/a&gt; that shows you how to use and create iterators and iterables for more efficient data processing.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;container border rounded text-wrap-pretty my-3&quot;&gt;

  &lt;p class=&quot;my-3&quot;&gt;&lt;mark class=&quot;marker-highlight&quot;&gt;&lt;strong&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt; Take the Quiz:&lt;/strong&gt;&lt;/mark&gt; Test your knowledge with our interactive “Iterators and Iterables in Python: Run Efficient Iterations” quiz. You’ll receive a score upon completion to help you track your learning progress:&lt;/p&gt;

  &lt;hr&gt;

  &lt;div class=&quot;row my-3&quot;&gt;
    &lt;div class=&quot;col-xs-12 col-sm-4 col-md-3 align-self-center&quot;&gt;

      &lt;a href=&quot;/quizzes/python-iterators-iterables/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 embed-responsive-item rounded&quot; style=&quot;object-fit: contain; background: #e5c5ac;&quot; alt=&quot;Iterators and Iterables in Python: Run Efficient Iterations&quot; src=&quot;https://files.realpython.com/media/Iterators-and-Iterables-in-Python-What-Are-They-and-How-to-Use-Them_Watermarked.5df74332ac58.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/Iterators-and-Iterables-in-Python-What-Are-They-and-How-to-Use-Them_Watermarked.5df74332ac58.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Iterators-and-Iterables-in-Python-What-Are-They-and-How-to-Use-Them_Watermarked.5df74332ac58.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Iterators-and-Iterables-in-Python-What-Are-They-and-How-to-Use-Them_Watermarked.5df74332ac58.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Iterators-and-Iterables-in-Python-What-Are-They-and-How-to-Use-Them_Watermarked.5df74332ac58.jpg 1920w&quot; sizes=&quot;(min-width: 1200px) 142px, (min-width: 1000px) 122px, (min-width: 780px) 112px, (min-width: 580px) 139px, calc(100vw - 62px)&quot;&gt;


          &lt;div class=&quot;card-img-overlay d-flex align-items-center&quot;&gt;
            &lt;div class=&quot;mx-auto&quot;&gt;
              &lt;span class=&quot;text-light&quot; style=&quot;opacity: 0.90;&quot;&gt;&lt;span class=&quot;icon baseline scale2x&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/a&gt;

    &lt;/div&gt;
    &lt;div class=&quot;col&quot;&gt;
      &lt;div class=&quot;mt-3 d-md-none&quot;&gt;&lt;/div&gt; 
      &lt;p class=&quot;small text-muted mb-0&quot;&gt;&lt;strong&gt;Interactive Quiz&lt;/strong&gt;&lt;/p&gt;
      &lt;a href=&quot;/quizzes/python-iterators-iterables/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Iterators and Iterables in Python: Run Efficient Iterations&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;In this quiz, you&#x27;ll test your understanding of Python&#x27;s iterators and iterables. By working through this quiz, you&#x27;ll revisit how to create and work with iterators and iterables, the differences between them, and review how to use generator functions.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;understanding-iteration-in-python&quot;&gt;Understanding Iteration in Python&lt;a class=&quot;headerlink&quot; href=&quot;#understanding-iteration-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;When writing computer programs, you often need to repeat a given piece of code multiple times. To do this, you can follow one of the following approaches:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Repeating the target code as many times as you need in a sequence&lt;/li&gt;
&lt;li&gt;Putting the target code in a loop that runs as many times as you need&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The first approach has a few drawbacks. The most troublesome issue is the repetitive code itself, which is hard to maintain and not scalable. For example, the following code will print a greeting message on your screen three times:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;python&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    &lt;span class=&quot;mr-2&quot; aria-label=&quot;Filename&quot;&gt;&lt;code style=&quot;color: inherit; background: inherit;&quot;&gt;greeting.py&lt;/code&gt;&lt;/span&gt;
    &lt;div class=&quot;noselect&quot;&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Hello!&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Hello!&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Hello!&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;If you &lt;a href=&quot;https://realpython.com/run-python-scripts/&quot;&gt;run this script&lt;/a&gt;, then you’ll get &lt;code&gt;&#x27;Hello!&#x27;&lt;/code&gt; printed on your screen three times. This code works. However, what if you decide to update your code to print &lt;code&gt;&#x27;Hello, World!&#x27;&lt;/code&gt; instead of just &lt;code&gt;&#x27;Hello!&#x27;&lt;/code&gt;? In that case, you’ll have to update the greeting message three times, which is a maintenance burden.&lt;/p&gt;
&lt;p&gt;Now imagine a similar situation but with a larger and more complex piece of code. It can become a nightmare for maintainers.&lt;/p&gt;
&lt;p&gt;Using a loop will be a much better way to solve the problem and avoid the maintainability issue. Loops allow you to run a piece of code as often as you need. Consider how you’d write the above example using a &lt;code&gt;while&lt;/code&gt; loop:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;times&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;times&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Hello!&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;times&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Hello!&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Hello!&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Hello!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This &lt;code&gt;while&lt;/code&gt; loop runs as long as the loop-continuation condition (&lt;code&gt;times &amp;lt; 3&lt;/code&gt;) remains true. In each iteration, the loop prints your greeting message and increments the control variable, &lt;code&gt;times&lt;/code&gt;. Now, if you decide to update your message, then you just have to modify one line, which makes your code way more maintainable.&lt;/p&gt;
&lt;p&gt;Python’s &lt;code&gt;while&lt;/code&gt; loop supports what’s known as &lt;a href=&quot;https://realpython.com/python-while-loop/&quot;&gt;indefinite iteration&lt;/a&gt;, which means executing the same block of code over and over again, a potentially undefined number of times.&lt;/p&gt;
&lt;p&gt;You’ll also find a different but similar type of iteration known as &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;definite iteration&lt;/a&gt;, which means going through the same code a predefined number of times. This kind of iteration is especially useful when you need to iterate over the items of a data stream one by one in a loop.&lt;/p&gt;
&lt;p&gt;To run an iteration like this, you typically use a &lt;code&gt;for&lt;/code&gt; loop in Python:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;numbers&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;number&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;numbers&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;number&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;...&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;2&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;3&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;4&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;5&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;In this example, the &lt;code&gt;numbers&lt;/code&gt; &lt;a href=&quot;https://realpython.com/python-lists-tuples/&quot;&gt;list&lt;/a&gt; represents your stream of data, which you’ll generically refer to as an &lt;a href=&quot;#getting-to-know-python-iterables&quot;&gt;iterable&lt;/a&gt; because you can iterate over it, as you’ll learn later in this tutorial. The loop goes over each value in &lt;code&gt;numbers&lt;/code&gt; and prints it to your screen.&lt;/p&gt;
&lt;p&gt;When you use a &lt;code&gt;while&lt;/code&gt; or &lt;code&gt;for&lt;/code&gt; loop to repeat a piece of code several times, you’re actually running an &lt;strong&gt;iteration&lt;/strong&gt;. That’s the name given to the process itself.&lt;/p&gt;
&lt;p&gt;In Python, if your iteration process requires going through the values or items in a data collection one item at a time, then you’ll need another piece to complete the puzzle. You’ll need an &lt;strong&gt;iterator&lt;/strong&gt;.&lt;/p&gt;
&lt;h2 id=&quot;getting-to-know-python-iterators&quot;&gt;Getting to Know Python Iterators&lt;a class=&quot;headerlink&quot; href=&quot;#getting-to-know-python-iterators&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-iterators-iterables/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-iterators-iterables/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #233: PyCoder&#x27;s Weekly 2024 Top Articles &amp; Missing Gems</title>
      <id>https://realpython.com/podcasts/rpp/233/</id>
      <link href="https://realpython.com/podcasts/rpp/233/"/>
      <updated>2025-01-03T12:00:00+00:00</updated>
      <summary>PyCoder&#x27;s Weekly included over 1,500 links to articles, blog posts, tutorials, and projects in 2024. Christopher Trudeau is back on the show this week to help wrap it all up by sharing some highlights and uncovering a few missing gems from the pile.</summary>
      <content type="html">
        &lt;p&gt;PyCoder&#x27;s Weekly included over 1,500 links to articles, blog posts, tutorials, and projects in 2024. Christopher Trudeau is back on the show this week to help wrap it all up by sharing some highlights and uncovering a few missing gems from the pile.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Learn From 2024&#x27;s Most Popular Python Tutorials and Courses</title>
      <id>https://realpython.com/popular-python-tutorials-2024/</id>
      <link href="https://realpython.com/popular-python-tutorials-2024/"/>
      <updated>2025-01-01T14:00:00+00:00</updated>
      <summary>Revisit your favorite Real Python tutorials and courses from 2024. Explore a wide range of topics, from mastering Python basics to building innovative projects and optimizing your workflow. It’s been an exciting year of learning, and there’s plenty to build on in 2025.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;As we welcome 2025, it’s the perfect time to reflect on the exciting advancements the Python community made in 2024. &lt;strong&gt;Python 3.13&lt;/strong&gt; stood out as a milestone release, introducing ground-breaking experimental features like &lt;a href=&quot;https://realpython.com/python313-free-threading-jit/&quot;&gt;free threading and a just-in-time (JIT) compiler&lt;/a&gt;, both designed to boost performance. &lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://realpython.com/python313-repl/&quot;&gt;REPL&lt;/a&gt; also received an upgrade, with a modern redesign that enhances the coding experience for developers of all levels. These updates, along with other &lt;a href=&quot;https://realpython.com/python313-new-features/&quot;&gt;cool new features&lt;/a&gt;, have reinforced Python’s reputation as a continually evolving and versatile language.&lt;/p&gt;
&lt;p&gt;Python’s influence continued to grow in 2024. It secured the top spot in &lt;a href=&quot;https://realpython.com/python-news-september-2024/#python-remains-the-top-language-of-2024&quot;&gt;IEEE Spectrum’s annual ranking&lt;/a&gt; of programming languages, while the &lt;a href=&quot;https://realpython.com/python-news-september-2024/#python-developers-survey-2023-results-are-in&quot;&gt;2023 Python Developers Survey&lt;/a&gt; further highlighted its widespread popularity and global appeal. &lt;/p&gt;
&lt;p&gt;Other notable developments include the release of &lt;a href=&quot;https://realpython.com/python-news-february-2024/#astral-unveils-python-packaging-in-rust&quot;&gt;Astral’s uv&lt;/a&gt; project manager and major releases of both &lt;a href=&quot;https://realpython.com/python-news-july-2024/#numpy-version-20&quot;&gt;NumPy&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-news-july-2024/#polars-version-10&quot;&gt;Polars&lt;/a&gt;. Plus, the release of &lt;a href=&quot;https://realpython.com/python-news-november-2024/#python-314-alpha-1-available&quot;&gt;Python 3.14 Alpha 1&lt;/a&gt; introduced lazy evaluation for annotations, fixing a long-standing pain point in Python’s type hinting capabilities.&lt;/p&gt;
&lt;p&gt;Here at Real Python, we’re excited to showcase the tutorials and video courses that engaged our readers and viewers throughout 2024. From mastering &lt;a href=&quot;https://realpython.com/learning-paths/python-basics/&quot;&gt;Python basics&lt;/a&gt; to &lt;a href=&quot;https://realpython.com/tutorials/projects/&quot;&gt;building innovative projects&lt;/a&gt;, sharpening &lt;a href=&quot;https://realpython.com/tutorials/data-science/&quot;&gt;data science skills&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/learning-paths/perfect-your-python-development-setup/&quot;&gt;optimizing your workflow&lt;/a&gt;, this list covers a wide range of topics to help you grow as a Python developer. &lt;/p&gt;
&lt;p&gt;Take a moment to explore the highlights of the year that inspired our community to learn, create, and achieve more with Python.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;&lt;p&gt;&lt;strong&gt;Join Now:&lt;/strong&gt; &lt;a href=&quot;&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-newsletter&quot; data-focus=&quot;false&quot;&gt;Click here to join the Real Python Newsletter&lt;/a&gt; and you&#x27;ll never miss another Python tutorial, course update, or post.&lt;/p&gt;&lt;/div&gt;

&lt;h2 id=&quot;set-up-your-work-environment&quot;&gt;Set Up Your Work Environment&lt;a class=&quot;headerlink&quot; href=&quot;#set-up-your-work-environment&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;figure class=&quot;&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid w-33 float-right ml-3 mt-3 mb-3 rounded&quot; src=&quot;https://files.realpython.com/media/Art-Customize-VS-Code-Settings.94a1f659ab0c.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/Art-Customize-VS-Code-Settings.94a1f659ab0c.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Art-Customize-VS-Code-Settings.94a1f659ab0c.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Art-Customize-VS-Code-Settings.94a1f659ab0c.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Art-Customize-VS-Code-Settings.94a1f659ab0c.jpg 1920w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;Customize VS Code Settings&quot; data-asset=&quot;5881&quot;&gt;&lt;/figure&gt;

&lt;p&gt;Before getting down to the business of coding, it’s important to have a well-organized workspace that boosts productivity and keeps frustrations at bay. Whether you’re customizing your code editor, setting up virtual environments, or managing project dependencies, the right tools can make all the difference.&lt;/p&gt;
&lt;p&gt;With these resources, you can learn how to set up a Python environment that works for you:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/courses/customize-vscode-settings/&quot;&gt;Customize VS Code Settings&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;Python Virtual Environments: A Primer&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;Using Python’s pip to Manage Your Projects’ Dependencies&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;By learning how to set up your Python environment correctly from the start, you’ll save time, reduce headaches, and enjoy a smoother, more pleasant coding experience.&lt;/p&gt;
&lt;h2 id=&quot;get-back-to-basics&quot;&gt;Get Back to Basics&lt;a class=&quot;headerlink&quot; href=&quot;#get-back-to-basics&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;figure class=&quot;&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid w-33 float-right ml-3 mt-3 mb-3 rounded&quot; src=&quot;https://files.realpython.com/media/Lists-and-Tuples_Watermarked.a1232313125d.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/Lists-and-Tuples_Watermarked.a1232313125d.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Lists-and-Tuples_Watermarked.a1232313125d.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Lists-and-Tuples_Watermarked.a1232313125d.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Lists-and-Tuples_Watermarked.a1232313125d.jpg 1920w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;Python Basics: Lists and Tuples&quot; data-asset=&quot;5628&quot;&gt;&lt;/figure&gt;

&lt;p&gt;No matter where you are in your Python journey, revisiting the basics can sharpen your skills and improve your coding habits. Building a solid foundation in topics like dictionaries, functions, loops, lists, and tuples will give you what it takes to write clean and maintainable code.&lt;/p&gt;
&lt;p&gt;In these exercise courses, you’ll practice Python fundamentals to help solidify your understanding:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/courses/basics-exercises-dictionaries/&quot;&gt;Python Basics Exercises: Dictionaries&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/courses/python-exercises-functions-loops/&quot;&gt;Python Basics Exercises: Functions and Loops&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/courses/python-basics-exercises-lists-tuples/&quot;&gt;Python Basics Exercises: Lists and Tuples&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Working through these courses will give you the clarity you need to explore more advanced programming topics.&lt;/p&gt;
&lt;h2 id=&quot;familiarize-yourself-with-functions&quot;&gt;Familiarize Yourself With Functions&lt;a class=&quot;headerlink&quot; href=&quot;#familiarize-yourself-with-functions&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/popular-python-tutorials-2024/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/popular-python-tutorials-2024/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Building HTTP APIs With Django REST Framework</title>
      <id>https://realpython.com/courses/django-rest-framework/</id>
      <link href="https://realpython.com/courses/django-rest-framework/"/>
      <updated>2024-12-31T14:00:00+00:00</updated>
      <summary>This course will get you ready to build HTTP APIs with Django REST Framework. The Django REST framework (DRF) is a toolkit built on top of the Django web framework that reduces the amount of code you need to write to create REST interfaces.</summary>
      <content type="html">
        &lt;p&gt;REST is a loosely defined protocol for listing, creating, changing, and deleting data on your server over HTTP. The Django REST framework (DRF) is a toolkit built on top of the Django web framework that reduces the amount of code you need to write to create REST HTTP API interfaces.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this course you&amp;rsquo;ll learn about:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;REST protocol&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;DRF &lt;strong&gt;&lt;code&gt;Serializers&lt;/code&gt;&lt;/strong&gt; and how to use them with Django objects&lt;/li&gt;
&lt;li&gt;Using Django &lt;code&gt;views&lt;/code&gt; and DRF &lt;code&gt;ViewSet&lt;/code&gt; classes to create REST &lt;strong&gt;end-points&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Multiple flavors of &lt;strong&gt;renderers&lt;/strong&gt; and how to control their output&lt;/li&gt;
&lt;li&gt;Specifying &lt;strong&gt;permissions&lt;/strong&gt; and limiting who can see what data in your REST API&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>How to Remove Items From Lists in Python</title>
      <id>https://realpython.com/remove-item-from-list-python/</id>
      <link href="https://realpython.com/remove-item-from-list-python/"/>
      <updated>2024-12-23T14:00:00+00:00</updated>
      <summary>In this how-to guide, you&#x27;ll explore different ways to remove items from lists in Python. Using practical examples, like managing a library book list and a contact book application, you&#x27;ll learn efficient techniques for handling list item removal.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Removing items from a Python list is a common task that you can accomplish with various techniques. Whether you need to remove an item by its position or value, Python has you covered. In this tutorial, you’ll explore different approaches to removing items from a list, including using &lt;code&gt;.pop()&lt;/code&gt;, the &lt;code&gt;del&lt;/code&gt; statement, and &lt;code&gt;.remove()&lt;/code&gt;. &lt;/p&gt;
&lt;p&gt;The &lt;code&gt;.remove()&lt;/code&gt; method allows you to delete the first occurrence of a specified value, while &lt;code&gt;.pop()&lt;/code&gt; can remove an item by its index and return it. The &lt;code&gt;del&lt;/code&gt; statement offers another way to remove items by index, and you can also use it to delete slices of a list. The approach you choose will depend on your specific needs.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this tutorial, you’ll understand that:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;To remove an item from a list in Python, you can use various approaches like &lt;strong&gt;&lt;code&gt;.pop()&lt;/code&gt;&lt;/strong&gt;,  &lt;strong&gt;&lt;code&gt;del&lt;/code&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;code&gt;.remove()&lt;/code&gt;&lt;/strong&gt;, and &lt;strong&gt;&lt;code&gt;.clear()&lt;/code&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;To remove items from a certain position in a list, you use the &lt;strong&gt;&lt;code&gt;.pop()&lt;/code&gt;&lt;/strong&gt; method.&lt;/li&gt;
&lt;li&gt;To delete items and slices from a list in Python, you use the &lt;strong&gt;&lt;code&gt;del&lt;/code&gt;&lt;/strong&gt; statement.&lt;/li&gt;
&lt;li&gt;You use the &lt;strong&gt;&lt;code&gt;.remove()&lt;/code&gt;&lt;/strong&gt; method to delete the first occurrence of a specified value from a list. &lt;/li&gt;
&lt;li&gt;To remove all the items from a list, you use &lt;strong&gt;&lt;code&gt;.clear()&lt;/code&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;You can also remove duplicate items using a &lt;strong&gt;loop&lt;/strong&gt;, &lt;strong&gt;dictionary&lt;/strong&gt;, or &lt;strong&gt;set&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get the most out of this tutorial, you should be familiar with basic Python &lt;a href=&quot;https://realpython.com/python-list/&quot;&gt;&lt;code&gt;list&lt;/code&gt;&lt;/a&gt; topics like &lt;a href=&quot;https://realpython.com/python-list/#constructing-lists-in-python&quot;&gt;creating lists&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-append/&quot;&gt;adding&lt;/a&gt; items to a list, and &lt;a href=&quot;https://realpython.com/python-list/#accessing-items-in-a-list-indexing&quot;&gt;accessing&lt;/a&gt; items in a list.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/remove-item-from-list-python-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-remove-item-from-list-python-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free sample code&lt;/a&gt; that you’ll use to remove items from lists in Python.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;container border rounded text-wrap-pretty my-3&quot;&gt;

  &lt;p class=&quot;my-3&quot;&gt;&lt;mark class=&quot;marker-highlight&quot;&gt;&lt;strong&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt; Take the Quiz:&lt;/strong&gt;&lt;/mark&gt; Test your knowledge with our interactive “How to Remove Items From Lists in Python” quiz. You’ll receive a score upon completion to help you track your learning progress:&lt;/p&gt;

  &lt;hr&gt;

  &lt;div class=&quot;row my-3&quot;&gt;
    &lt;div class=&quot;col-xs-12 col-sm-4 col-md-3 align-self-center&quot;&gt;

      &lt;a href=&quot;/quizzes/remove-item-from-list-python/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 embed-responsive-item rounded&quot; style=&quot;object-fit: contain; background: #ffc873;&quot; alt=&quot;Python&#x27;s list Data Type: A Deep Dive With Examples&quot; src=&quot;https://files.realpython.com/media/Pythons-list-Built-in-Data-Type-A-Deep-Dive-With-Examples_Watermarked.1f6291ed72f5.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/Pythons-list-Built-in-Data-Type-A-Deep-Dive-With-Examples_Watermarked.1f6291ed72f5.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Pythons-list-Built-in-Data-Type-A-Deep-Dive-With-Examples_Watermarked.1f6291ed72f5.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Pythons-list-Built-in-Data-Type-A-Deep-Dive-With-Examples_Watermarked.1f6291ed72f5.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Pythons-list-Built-in-Data-Type-A-Deep-Dive-With-Examples_Watermarked.1f6291ed72f5.jpg 1920w&quot; sizes=&quot;(min-width: 1200px) 142px, (min-width: 1000px) 122px, (min-width: 780px) 112px, (min-width: 580px) 139px, calc(100vw - 62px)&quot;&gt;


          &lt;div class=&quot;card-img-overlay d-flex align-items-center&quot;&gt;
            &lt;div class=&quot;mx-auto&quot;&gt;
              &lt;span class=&quot;text-light&quot; style=&quot;opacity: 0.90;&quot;&gt;&lt;span class=&quot;icon baseline scale2x&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/a&gt;

    &lt;/div&gt;
    &lt;div class=&quot;col&quot;&gt;
      &lt;div class=&quot;mt-3 d-md-none&quot;&gt;&lt;/div&gt; 
      &lt;p class=&quot;small text-muted mb-0&quot;&gt;&lt;strong&gt;Interactive Quiz&lt;/strong&gt;&lt;/p&gt;
      &lt;a href=&quot;/quizzes/remove-item-from-list-python/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;How to Remove Items From Lists in Python&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;In this quiz, you&#x27;ll test your understanding of removing items from lists in Python. This is a fundamental skill in Python programming, and mastering it will enable you to manipulate lists effectively.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;how-to-remove-specific-items-from-a-list&quot;&gt;How to Remove Specific Items From a List&lt;a class=&quot;headerlink&quot; href=&quot;#how-to-remove-specific-items-from-a-list&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;One common operation you’ll perform on a Python &lt;a href=&quot;https://realpython.com/python-list/&quot;&gt;&lt;code&gt;list&lt;/code&gt;&lt;/a&gt; is to remove specific list items. You may need to remove items based on their position in the list, or their value.&lt;/p&gt;
&lt;p&gt;To illustrate how you can accomplish this task, suppose you’re creating a website for a public library. Your web app will allow users to save a list of books they would like to read. It should also allow them to edit and remove books from the list, as well as sort the list.&lt;/p&gt;
&lt;p&gt;You can use a Python list to store the user’s reading list as a collection of book titles. For example, the reading list might look something like this:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;books&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Dragonsbane&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;The Hobbit&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Wonder&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Jaws&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Now that you have a list of books, you have several ways to remove a single, specific book from the list. One approach is to use the &lt;code&gt;.pop()&lt;/code&gt; method.&lt;/p&gt;
&lt;h3 id=&quot;removing-items-using-the-pop-method&quot;&gt;Removing Items Using the &lt;code&gt;.pop()&lt;/code&gt; Method&lt;a class=&quot;headerlink&quot; href=&quot;#removing-items-using-the-pop-method&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Sometimes, you may need to remove items at a certain position in a list. For example, in a public library app, users might select books to remove by ticking checkboxes in the user interface. Your app will delete each selected item based on its &lt;strong&gt;index&lt;/strong&gt;, which is the item’s position in the list.&lt;/p&gt;
&lt;p&gt;If you know the index of the item you want to remove, then you can use the &lt;code&gt;.pop()&lt;/code&gt; method. This method takes the item’s index as an optional argument and then removes and returns the item at that index. If you don’t pass an index argument to the method call, then &lt;code&gt;.pop()&lt;/code&gt; will remove and return the last item in the list.&lt;/p&gt;
&lt;p&gt;Note that Python lists use &lt;a href=&quot;https://python-history.blogspot.com/2013/10/why-python-uses-0-based-indexing.html&quot;&gt;zero-based indexing&lt;/a&gt; for positioning, which means that the first element in a list is at index 0, the second element is at index 1, and so on. With that in mind, here’s an example of how you can use &lt;code&gt;.pop()&lt;/code&gt; to remove and display the first element in your &lt;code&gt;books&lt;/code&gt; list:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;books&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&#x27;Dragonsbane&#x27;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You invoke the &lt;code&gt;.pop()&lt;/code&gt; method on the &lt;code&gt;books&lt;/code&gt; list with an index of &lt;code&gt;0&lt;/code&gt;, indicating the first element in the list. This call removes the first title, &lt;em&gt;Dragonsbane&lt;/em&gt;, from the list and then returns it.&lt;/p&gt;
&lt;p&gt;If you check the content of your list after running this code, then you’ll notice that &lt;em&gt;Dragonsbane&lt;/em&gt; isn’t there anymore:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;books&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[&#x27;The Hobbit&#x27;, &#x27;Wonder&#x27;, &#x27;Jaws&#x27;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Here, you display the book list again after the &lt;code&gt;.pop()&lt;/code&gt; call. You can see that your list is now one element shorter because &lt;code&gt;.pop()&lt;/code&gt; removed the first title.&lt;/p&gt;
&lt;p&gt;As you learned earlier in the tutorial, &lt;code&gt;.pop()&lt;/code&gt; removes an item and also returns its value, which you can then use for other operations. For example, suppose the library app also allows users to store a separate list of books they’ve read. Once the user has read a book, they can remove it from the initial book list and transfer the title to the read list:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;books&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Dragonsbane&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;The Hobbit&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Wonder&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Jaws&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;read_books&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;read&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;books&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pop&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;read_books&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;append&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;read&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;read_books&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[&#x27;Dragonsbane&#x27;]&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;books&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[&#x27;The Hobbit&#x27;, &#x27;Wonder&#x27;, &#x27;Jaws&#x27;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;On the second line in the example, you create a new, empty list called &lt;code&gt;read_books&lt;/code&gt; to store the names of the books the user has read. Next, you use the &lt;code&gt;.pop()&lt;/code&gt; method to remove the first title from the original book list and store it in a variable. Then, you use &lt;a href=&quot;https://realpython.com/python-append/&quot;&gt;&lt;code&gt;.append()&lt;/code&gt;&lt;/a&gt; to add the stored title to the &lt;code&gt;read_books&lt;/code&gt; list.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/remove-item-from-list-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/remove-item-from-list-python/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>How to Flatten a List of Lists in Python</title>
      <id>https://realpython.com/python-flatten-list/</id>
      <link href="https://realpython.com/python-flatten-list/"/>
      <updated>2024-12-22T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn how to flatten a list of lists in Python. You&#x27;ll use different tools and techniques to accomplish this task. First, you&#x27;ll use a loop along with the .extend() method of list. Then you&#x27;ll explore other tools, including reduce(), sum(), itertools.chain(), and more.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Flattening a list in Python involves converting a nested list structure into a single, one-dimensional list. A common approach to flatten a list of lists is to use a &lt;code&gt;for&lt;/code&gt; loop to iterate through each sublist. Then, add each item to a new list with the &lt;code&gt;.extend()&lt;/code&gt; method or the augmented concatenation operator (&lt;code&gt;+=&lt;/code&gt;). This will “unlist” the list, resulting in a flattened list.&lt;/p&gt;
&lt;p&gt;Alternatively, Python’s standard library offers tools like &lt;code&gt;itertools.chain()&lt;/code&gt; and &lt;code&gt;functools.reduce()&lt;/code&gt; to achieve similar results. You can also use a list comprehension for a concise one-liner solution. Each method has its own performance characteristics, with &lt;code&gt;for&lt;/code&gt; loops and list comprehensions generally being more efficient.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this tutorial, you’ll understand that:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Flattening a list&lt;/strong&gt; involves converting nested lists into a single list.&lt;/li&gt;
&lt;li&gt;You can use a &lt;strong&gt;&lt;code&gt;for&lt;/code&gt; loop and &lt;code&gt;.extend()&lt;/code&gt;&lt;/strong&gt; to flatten lists in Python.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;List comprehensions&lt;/strong&gt; provide a concise syntax for list transformations.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Standard-library functions&lt;/strong&gt; like &lt;code&gt;itertools.chain()&lt;/code&gt; and &lt;code&gt;functools.reduce()&lt;/code&gt; can also flatten lists.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;&lt;code&gt;.flatten()&lt;/code&gt; method in NumPy&lt;/strong&gt; efficiently flattens arrays for data science tasks.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Unlisting a list&lt;/strong&gt; means to flatten nested lists into one list.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To better illustrate what it means to flatten a list, say that you have the following matrix of numeric values:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;matrix&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;matrix&lt;/code&gt; variable holds a Python &lt;a href=&quot;https://realpython.com/python-list/&quot;&gt;list&lt;/a&gt; that contains four nested lists. Each nested list represents a row in the matrix. The rows store four items or numbers each. Now say that you want to turn this matrix into the following list:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;python&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;4&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;How do you manage to flatten your matrix and get a one-dimensional list like the one above? In this tutorial, you’ll learn how to do that in Python.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-flatten-list-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-flatten-list-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free sample code&lt;/a&gt; that showcases and compares several ways to flatten a list of lists in Python.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;container border rounded text-wrap-pretty my-3&quot;&gt;

  &lt;p class=&quot;my-3&quot;&gt;&lt;mark class=&quot;marker-highlight&quot;&gt;&lt;strong&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt; Take the Quiz:&lt;/strong&gt;&lt;/mark&gt; Test your knowledge with our interactive “How to Flatten a List of Lists in Python” quiz. You’ll receive a score upon completion to help you track your learning progress:&lt;/p&gt;

  &lt;hr&gt;

  &lt;div class=&quot;row my-3&quot;&gt;
    &lt;div class=&quot;col-xs-12 col-sm-4 col-md-3 align-self-center&quot;&gt;

      &lt;a href=&quot;/quizzes/python-flatten-list/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 embed-responsive-item rounded&quot; style=&quot;object-fit: contain; background: #aae4b1;&quot; alt=&quot;How to Flatten a List of Lists in Python&quot; src=&quot;https://files.realpython.com/media/How-to-Flatten-a-List-of-Lists_Watermarked.2f9407737589.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/How-to-Flatten-a-List-of-Lists_Watermarked.2f9407737589.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/How-to-Flatten-a-List-of-Lists_Watermarked.2f9407737589.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/How-to-Flatten-a-List-of-Lists_Watermarked.2f9407737589.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/How-to-Flatten-a-List-of-Lists_Watermarked.2f9407737589.jpg 1920w&quot; sizes=&quot;(min-width: 1200px) 142px, (min-width: 1000px) 122px, (min-width: 780px) 112px, (min-width: 580px) 139px, calc(100vw - 62px)&quot;&gt;


          &lt;div class=&quot;card-img-overlay d-flex align-items-center&quot;&gt;
            &lt;div class=&quot;mx-auto&quot;&gt;
              &lt;span class=&quot;text-light&quot; style=&quot;opacity: 0.90;&quot;&gt;&lt;span class=&quot;icon baseline scale2x&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/a&gt;

    &lt;/div&gt;
    &lt;div class=&quot;col&quot;&gt;
      &lt;div class=&quot;mt-3 d-md-none&quot;&gt;&lt;/div&gt; 
      &lt;p class=&quot;small text-muted mb-0&quot;&gt;&lt;strong&gt;Interactive Quiz&lt;/strong&gt;&lt;/p&gt;
      &lt;a href=&quot;/quizzes/python-flatten-list/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;How to Flatten a List of Lists in Python&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;In this quiz, you&#x27;ll test your understanding of how to flatten a list in Python. Flattening a list involves converting a multidimensional list, such as a matrix, into a one-dimensional list. This is a common operation when working with data stored as nested lists.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;how-to-flatten-a-list-of-lists-with-a-for-loop&quot;&gt;How to Flatten a List of Lists With a &lt;code&gt;for&lt;/code&gt; Loop&lt;a class=&quot;headerlink&quot; href=&quot;#how-to-flatten-a-list-of-lists-with-a-for-loop&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;How can you flatten a list of lists in Python? In general, to flatten a list of lists, you can run the following steps either explicitly or implicitly:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Create&lt;/strong&gt; a new empty list to store the &lt;strong&gt;flattened data&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Iterate&lt;/strong&gt; over each &lt;strong&gt;nested list&lt;/strong&gt; or sublist in the original list.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Add&lt;/strong&gt; every &lt;strong&gt;item&lt;/strong&gt; from the current sublist to the list of flattened data.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Return&lt;/strong&gt; the resulting list with the &lt;strong&gt;flattened data&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You can follow several paths and use multiple tools to run these steps in Python. Arguably, the most natural and readable way to do this is to use a &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;&lt;code&gt;for&lt;/code&gt; loop&lt;/a&gt;, which allows you to explicitly iterate over the sublists.&lt;/p&gt;
&lt;p&gt;Then you need a way to add items to the new flattened list. For that, you have a couple of valid options. First, you’ll turn to the &lt;code&gt;.extend()&lt;/code&gt; method from the &lt;code&gt;list&lt;/code&gt; class itself, and then you’ll give the &lt;a href=&quot;https://realpython.com/python-assignment-operator/#augmented-assignments-for-concatenation-and-repetition&quot;&gt;augmented concatenation operator&lt;/a&gt; (&lt;code&gt;+=&lt;/code&gt;) a go.&lt;/p&gt;
&lt;p&gt;To continue with the &lt;code&gt;matrix&lt;/code&gt; example, here’s how you would translate these steps into Python code using a &lt;code&gt;for&lt;/code&gt; loop and the &lt;code&gt;.extend()&lt;/code&gt; method:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;flatten_extend&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;matrix&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;flat_list&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;row&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;matrix&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;        &lt;span class=&quot;n&quot;&gt;flat_list&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;extend&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;row&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;flat_list&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Inside &lt;code&gt;flatten_extend()&lt;/code&gt;, you first create a new empty list called &lt;code&gt;flat_list&lt;/code&gt;. You’ll use this list to store the flattened data when you extract it from &lt;code&gt;matrix&lt;/code&gt;. Then you start a loop to iterate over the inner, or nested, lists from &lt;code&gt;matrix&lt;/code&gt;. In this example, you use the name &lt;code&gt;row&lt;/code&gt; to represent the current nested list.&lt;/p&gt;
&lt;p&gt;In every iteration, you use &lt;code&gt;.extend()&lt;/code&gt; to add the content of the current sublist to &lt;code&gt;flat_list&lt;/code&gt;. This method takes an &lt;a href=&quot;https://realpython.com/python-iterators-iterables/&quot;&gt;iterable&lt;/a&gt; as an argument and appends its items to the end of the target list.&lt;/p&gt;
&lt;p&gt;Now go ahead and run the following code to check that your function does the job:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;flatten_extend&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;matrix&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;[9, 3, 8, 3, 4, 5, 2, 8, 6, 4, 3, 1, 1, 0, 4, 5]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;That’s neat! You’ve flattened your first list of lists. As a result, you have a one-dimensional list containing all the numeric values from &lt;code&gt;matrix&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;With &lt;code&gt;.extend()&lt;/code&gt;, you’ve come up with a Pythonic and readable way to flatten your lists. You can get the same result using the &lt;a href=&quot;https://realpython.com/python-assignment-operator/#augmented-assignments-for-concatenation-and-repetition&quot;&gt;augmented concatenation operator&lt;/a&gt; (&lt;code&gt;+=&lt;/code&gt;) on your &lt;code&gt;flat_list&lt;/code&gt; object. However, this alternative approach may not be as readable:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;flatten_concatenation&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;matrix&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;n&quot;&gt;flat_list&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[]&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;row&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;matrix&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
&lt;span class=&quot;hll&quot;&gt;&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;        &lt;span class=&quot;n&quot;&gt;flat_list&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;row&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;gp&quot;&gt;... &lt;/span&gt;    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;flat_list&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-flatten-list/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-flatten-list/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Strings and Character Data in Python</title>
      <id>https://realpython.com/python-strings/</id>
      <link href="https://realpython.com/python-strings/"/>
      <updated>2024-12-22T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn how to use Python&#x27;s rich set of operators and functions for working with strings. You&#x27;ll cover the basics of creating strings using literals and the str() function, applying string methods, using operators and built-in functions with strings, and more!</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Python strings are a sequence of characters used for handling textual data. You can create strings in Python using quotation marks or the &lt;code&gt;str()&lt;/code&gt; function, which converts objects into strings. Strings in Python are immutable, meaning once you define a string, you can’t change it.&lt;/p&gt;
&lt;p&gt;To access specific elements of a string, you use indexing, where indices start at &lt;code&gt;0&lt;/code&gt; for the first character. You specify an index in square brackets, such as &lt;code&gt;&quot;hello&quot;[0]&lt;/code&gt;, which gives you &lt;code&gt;&quot;h&quot;&lt;/code&gt;. For string interpolation you can use curly braces &lt;code&gt;{}&lt;/code&gt; in a string.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this tutorial, you’ll understand that:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A Python &lt;strong&gt;string&lt;/strong&gt; is a &lt;strong&gt;sequence of characters&lt;/strong&gt; used for textual data.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;&lt;code&gt;str()&lt;/code&gt; function&lt;/strong&gt; converts objects to their &lt;strong&gt;string representation&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;You can use &lt;strong&gt;curly braces &lt;code&gt;{}&lt;/code&gt;&lt;/strong&gt; to insert values in a Python string.&lt;/li&gt;
&lt;li&gt;You &lt;strong&gt;access string elements&lt;/strong&gt; in Python using &lt;strong&gt;indexing&lt;/strong&gt; with square brackets.&lt;/li&gt;
&lt;li&gt;You can &lt;strong&gt;join&lt;/strong&gt; all &lt;strong&gt;elements in a list&lt;/strong&gt; into a single &lt;strong&gt;string&lt;/strong&gt; using &lt;code&gt;.join()&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You’ll explore creating strings with string literals and functions, using operators and built-in functions with strings, indexing and slicing techniques, and methods for string interpolation and formatting. These skills will help you manipulate and format textual data in your Python programs effectively.&lt;/p&gt;
&lt;p&gt;To get the most out of this tutorial, you should have a good understanding of core Python concepts, including &lt;a href=&quot;https://realpython.com/python-variables/&quot;&gt;variables&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;functions&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-operators-expressions/&quot;&gt;operators and expressions&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-string-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-string-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free sample code&lt;/a&gt; that shows you how to work with strings and character data in Python.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;container border rounded text-wrap-pretty my-3&quot;&gt;

  &lt;p class=&quot;my-3&quot;&gt;&lt;mark class=&quot;marker-highlight&quot;&gt;&lt;strong&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt; Take the Quiz:&lt;/strong&gt;&lt;/mark&gt; Test your knowledge with our interactive “Python Strings and Character Data” quiz. You’ll receive a score upon completion to help you track your learning progress:&lt;/p&gt;

  &lt;hr&gt;

  &lt;div class=&quot;row my-3&quot;&gt;
    &lt;div class=&quot;col-xs-12 col-sm-4 col-md-3 align-self-center&quot;&gt;

      &lt;a href=&quot;/quizzes/python-strings/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 embed-responsive-item rounded&quot; style=&quot;object-fit: contain; background: #abe0e6;&quot; alt=&quot;Strings and Character Data in Python&quot; src=&quot;https://files.realpython.com/media/Strings-and-Character-Data-in-Python_Watermarked.797803948b10.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/Strings-and-Character-Data-in-Python_Watermarked.797803948b10.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Strings-and-Character-Data-in-Python_Watermarked.797803948b10.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Strings-and-Character-Data-in-Python_Watermarked.797803948b10.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Strings-and-Character-Data-in-Python_Watermarked.797803948b10.jpg 1920w&quot; sizes=&quot;(min-width: 1200px) 142px, (min-width: 1000px) 122px, (min-width: 780px) 112px, (min-width: 580px) 139px, calc(100vw - 62px)&quot;&gt;


          &lt;div class=&quot;card-img-overlay d-flex align-items-center&quot;&gt;
            &lt;div class=&quot;mx-auto&quot;&gt;
              &lt;span class=&quot;text-light&quot; style=&quot;opacity: 0.90;&quot;&gt;&lt;span class=&quot;icon baseline scale2x&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/a&gt;

    &lt;/div&gt;
    &lt;div class=&quot;col&quot;&gt;
      &lt;div class=&quot;mt-3 d-md-none&quot;&gt;&lt;/div&gt; 
      &lt;p class=&quot;small text-muted mb-0&quot;&gt;&lt;strong&gt;Interactive Quiz&lt;/strong&gt;&lt;/p&gt;
      &lt;a href=&quot;/quizzes/python-strings/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Python Strings and Character Data&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;This quiz will test your understanding of Python&#x27;s string data type and your knowledge about manipulating textual data with string objects. You&#x27;ll cover the basics of creating strings using literals and the str() function, applying string methods, using operators and built-in functions, and more!&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;getting-to-know-strings-and-characters-in-python&quot;&gt;Getting to Know Strings and Characters in Python&lt;a class=&quot;headerlink&quot; href=&quot;#getting-to-know-strings-and-characters-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Python provides the &lt;a href=&quot;https://realpython.com/python-data-types/#strings-and-characters&quot;&gt;built-in string (&lt;code&gt;str&lt;/code&gt;)&lt;/a&gt; data type to handle textual data. Other programming languages, such as &lt;a href=&quot;https://realpython.com/java-vs-python/&quot;&gt;Java&lt;/a&gt;, have a character data type for single characters. Python doesn’t have that. Single characters are strings of length one.&lt;/p&gt;
&lt;p&gt;In practice, strings are &lt;a href=&quot;https://realpython.com/python-mutable-vs-immutable-types/#immutable-built-in-data-types-in-python&quot;&gt;immutable&lt;/a&gt; sequences of characters. This means you can’t change a string once you define it. Any operation that modifies a string will create a new string instead of modifying the original one.&lt;/p&gt;
&lt;p&gt;A string is also a &lt;a href=&quot;https://realpython.com/python-sequences/&quot;&gt;sequence&lt;/a&gt;, which means that the characters in a string have a consecutive order. This feature allows you to access characters using integer indices that start with &lt;code&gt;0&lt;/code&gt;. You’ll learn more about these concepts in the section about &lt;a href=&quot;#indexing-strings&quot;&gt;indexing strings&lt;/a&gt;. For now, you’ll learn about how to create strings in Python.&lt;/p&gt;
&lt;h2 id=&quot;creating-strings-in-python&quot;&gt;Creating Strings in Python&lt;a class=&quot;headerlink&quot; href=&quot;#creating-strings-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;There are different ways to create strings in Python. The most common practice is to use string &lt;a href=&quot;https://docs.python.org/3/reference/lexical_analysis.html#literals&quot;&gt;literals&lt;/a&gt;. Because strings are everywhere and have many use cases, you’ll find a few different types of string literals. There are standard literals, raw literals, and formatted literals.&lt;/p&gt;
&lt;p&gt;Additionally, you can use the built-in &lt;code&gt;str()&lt;/code&gt; function to create new strings from other existing objects.&lt;/p&gt;
&lt;p&gt;In the following sections, you’ll learn about the multiple ways to create strings in Python and when to use each of them.&lt;/p&gt;
&lt;h3 id=&quot;standard-string-literals&quot;&gt;Standard String Literals&lt;a class=&quot;headerlink&quot; href=&quot;#standard-string-literals&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A standard string literal is just a piece of text or a &lt;a href=&quot;https://realpython.com/python-sequences/&quot;&gt;sequence&lt;/a&gt; of characters that you enclose in quotes. To create single-line strings, you can use single (&lt;code&gt;&#x27;&#x27;&lt;/code&gt;) and double (&lt;code&gt;&quot;&quot;&lt;/code&gt;) quotes:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&#x27;A single-line string in single quotes&#x27;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&#x27;A single-line string in single quotes&#x27;&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;A single-line string in double quotes&quot;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&#x27;A single-line string in double quotes&#x27;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;In the first example, you use single quotes to delimit the string literal. In the second example, you use double quotes.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Python’s standard &lt;a href=&quot;https://realpython.com/python-repl/&quot;&gt;REPL&lt;/a&gt; displays string objects using single quotes even though you create them using double quotes.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;You can define empty strings using quotes without placing characters between them:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&#x27;&#x27;&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&#x27;&#x27;&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&#x27;&#x27;&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;An empty string doesn’t contain any characters, so when you use the built-in &lt;a href=&quot;https://realpython.com/len-python-function/&quot;&gt;&lt;code&gt;len()&lt;/code&gt;&lt;/a&gt; function with an empty string as an argument, you get &lt;code&gt;0&lt;/code&gt; as a result.&lt;/p&gt;
&lt;p&gt;To create multiline strings, you can use triple-quoted strings. In this case, you can use either single or double quotes:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-strings/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-strings/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Working With JSON Data in Python</title>
      <id>https://realpython.com/python-json/</id>
      <link href="https://realpython.com/python-json/"/>
      <updated>2024-12-22T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn how to read and write JSON-encoded data in Python. You&#x27;ll begin with practical examples that show how to use Python&#x27;s built-in &quot;json&quot; module and then move on to learn how to serialize and deserialize custom data.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Python’s &lt;code&gt;json&lt;/code&gt; module provides you with the tools you need to effectively handle JSON data. You can convert Python data types to a JSON-formatted string with &lt;code&gt;json.dumps()&lt;/code&gt; or write them to files using &lt;code&gt;json.dump()&lt;/code&gt;. Similarly, you can read JSON data from files with &lt;code&gt;json.load()&lt;/code&gt; and parse JSON strings with &lt;code&gt;json.loads()&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;JSON, or JavaScript Object Notation, is a widely-used text-based format for data interchange. Its syntax resembles Python dictionaries but with some differences, such as using only double quotes for strings and lowercase for Boolean values. With built-in tools for validating syntax and manipulating JSON files, Python makes it straightforward to work with JSON data.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this tutorial, you’ll understand that:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;JSON in Python is handled using the &lt;strong&gt;standard-library &lt;code&gt;json&lt;/code&gt; module&lt;/strong&gt;, which allows for &lt;strong&gt;data interchange&lt;/strong&gt; between JSON and Python data types.&lt;/li&gt;
&lt;li&gt;JSON is a good data format to use with Python as it’s &lt;strong&gt;human-readable&lt;/strong&gt; and straightforward to &lt;strong&gt;serialize and deserialize&lt;/strong&gt;, which makes it ideal for use in &lt;strong&gt;APIs and data storage&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;You write JSON with Python using &lt;strong&gt;&lt;code&gt;json.dump()&lt;/code&gt;&lt;/strong&gt; to serialize data to a file.&lt;/li&gt;
&lt;li&gt;You can &lt;strong&gt;minify and prettify JSON&lt;/strong&gt; using Python’s &lt;code&gt;json.tool&lt;/code&gt; module.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Since its introduction, &lt;a href=&quot;https://en.wikipedia.org/wiki/JSON&quot;&gt;JSON&lt;/a&gt; has rapidly emerged as the predominant standard for the exchange of information. Whether you want to transfer data with an &lt;a href=&quot;https://realpython.com/api-integration-in-python/&quot;&gt;API&lt;/a&gt; or store information in a &lt;a href=&quot;https://realpython.com/introduction-to-mongodb-and-python/&quot;&gt;document database&lt;/a&gt;, it’s likely you’ll encounter JSON. Fortunately, Python provides robust tools to facilitate this process and help you manage JSON data efficiently.&lt;/p&gt;
&lt;p&gt;While JSON is the most common format for data distribution, it’s not the only option for such tasks. Both &lt;a href=&quot;https://realpython.com/python-xml-parser/&quot;&gt;XML&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-yaml/&quot;&gt;YAML&lt;/a&gt; serve similar purposes. If you’re interested in how the formats differ, then you can check out the tutorial on how to &lt;a href=&quot;https://realpython.com/python-serialize-data/&quot;&gt;serialize your data with Python&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Free Bonus:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-json/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-json&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free sample code&lt;/a&gt; that shows you how to work with JSON data in Python.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;container border rounded text-wrap-pretty my-3&quot;&gt;

  &lt;p class=&quot;my-3&quot;&gt;&lt;mark class=&quot;marker-highlight&quot;&gt;&lt;strong&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt; Take the Quiz:&lt;/strong&gt;&lt;/mark&gt; Test your knowledge with our interactive “Working With JSON Data in Python” quiz. You’ll receive a score upon completion to help you track your learning progress:&lt;/p&gt;

  &lt;hr&gt;

  &lt;div class=&quot;row my-3&quot;&gt;
    &lt;div class=&quot;col-xs-12 col-sm-4 col-md-3 align-self-center&quot;&gt;

      &lt;a href=&quot;/quizzes/python-json/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 embed-responsive-item rounded&quot; style=&quot;object-fit: contain; background: #ff7e74;&quot; alt=&quot;Working With JSON Data in Python&quot; src=&quot;https://files.realpython.com/media/Working-With-JSON-Data-in-Python_Watermarked.66a8fdcb8859.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/Working-With-JSON-Data-in-Python_Watermarked.66a8fdcb8859.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Working-With-JSON-Data-in-Python_Watermarked.66a8fdcb8859.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Working-With-JSON-Data-in-Python_Watermarked.66a8fdcb8859.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Working-With-JSON-Data-in-Python_Watermarked.66a8fdcb8859.jpg 1920w&quot; sizes=&quot;(min-width: 1200px) 142px, (min-width: 1000px) 122px, (min-width: 780px) 112px, (min-width: 580px) 139px, calc(100vw - 62px)&quot;&gt;


          &lt;div class=&quot;card-img-overlay d-flex align-items-center&quot;&gt;
            &lt;div class=&quot;mx-auto&quot;&gt;
              &lt;span class=&quot;text-light&quot; style=&quot;opacity: 0.90;&quot;&gt;&lt;span class=&quot;icon baseline scale2x&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/a&gt;

    &lt;/div&gt;
    &lt;div class=&quot;col&quot;&gt;
      &lt;div class=&quot;mt-3 d-md-none&quot;&gt;&lt;/div&gt; 
      &lt;p class=&quot;small text-muted mb-0&quot;&gt;&lt;strong&gt;Interactive Quiz&lt;/strong&gt;&lt;/p&gt;
      &lt;a href=&quot;/quizzes/python-json/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Working With JSON Data in Python&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;In this quiz, you&#x27;ll test your understanding of working with JSON in Python. By working through this quiz, you&#x27;ll revisit key concepts related to JSON data manipulation and handling in Python.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;introducing-json&quot;&gt;Introducing JSON&lt;a class=&quot;headerlink&quot; href=&quot;#introducing-json&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The acronym &lt;strong&gt;JSON&lt;/strong&gt; stands for &lt;a href=&quot;https://www.json.org/&quot;&gt;JavaScript Object Notation&lt;/a&gt;. As the name suggests, JSON originated from &lt;a href=&quot;https://realpython.com/python-vs-javascript/&quot;&gt;JavaScript&lt;/a&gt;. However, JSON has transcended its origins to become language-agnostic and is now recognized as the &lt;a href=&quot;https://tools.ietf.org/html/rfc8259&quot;&gt;standard&lt;/a&gt; for &lt;strong&gt;data interchange&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The popularity of JSON can be attributed to native support by the JavaScript language, resulting in excellent parsing performance in web browsers. On top of that, JSON’s straightforward syntax allows both humans and computers to read and write JSON data effortlessly.&lt;/p&gt;
&lt;p&gt;To get a first impression of JSON, have a look at this example code:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;json&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--purple&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;JSON&lt;/span&gt;
    &lt;span class=&quot;mr-2&quot; aria-label=&quot;Filename&quot;&gt;&lt;code style=&quot;color: inherit; background: inherit;&quot;&gt;hello_world.json&lt;/code&gt;&lt;/span&gt;
    &lt;div class=&quot;noselect&quot;&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;w&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;greeting&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Hello, world!&quot;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You’ll learn more about the JSON syntax later in this tutorial. For now, recognize that the JSON format is &lt;strong&gt;text-based&lt;/strong&gt;. In other words, you can create JSON files using the code editor of your choice. Once you set the file extension to &lt;code&gt;.json&lt;/code&gt;, most code editors display your JSON data with syntax highlighting out of the box:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/json-syntax-highlighting.bf172e2b07bd.png&quot; target=&quot;_blank&quot;&gt;&lt;img loading=&quot;lazy&quot; class=&quot;img-fluid mx-auto d-block &quot; src=&quot;https://files.realpython.com/media/json-syntax-highlighting.bf172e2b07bd.png&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/json-syntax-highlighting.bf172e2b07bd.png 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/json-syntax-highlighting.bf172e2b07bd.png 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/json-syntax-highlighting.bf172e2b07bd.png 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/json-syntax-highlighting.bf172e2b07bd.png 1920w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;Editor screenshot with code highlighting for a JSON file&quot; data-asset=&quot;5839&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;The screenshot above shows how &lt;a href=&quot;https://realpython.com/python-development-visual-studio-code/&quot;&gt;VS Code&lt;/a&gt; displays JSON data using the &lt;a href=&quot;https://marketplace.visualstudio.com/items?itemName=BeardedBear.beardedtheme&quot;&gt;Bearded color theme&lt;/a&gt;. You’ll have a closer look at the syntax of the JSON format next!&lt;/p&gt;
&lt;h3 id=&quot;examining-json-syntax&quot;&gt;Examining JSON Syntax&lt;a class=&quot;headerlink&quot; href=&quot;#examining-json-syntax&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;In the previous section, you got a first impression of how JSON data looks. And as a Python developer, the JSON structure probably reminds you of &lt;a href=&quot;https://realpython.com/python-data-structures/&quot;&gt;common Python data structures&lt;/a&gt;, like a dictionary that contains a string as a key and a value. If you understand the syntax of a &lt;a href=&quot;https://realpython.com/python-dicts/&quot;&gt;dictionary&lt;/a&gt; in Python, you already know the general syntax of a &lt;strong&gt;JSON object&lt;/strong&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Later in this tutorial, you’ll learn that you’re free to use lists and other data types at the top level of a JSON document.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The similarity between Python dictionaries and JSON objects is no surprise. One idea behind establishing JSON as the go-to data interchange format was to make working with JSON as convenient as possible, independently of which programming language you use:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;[A collection of key-value pairs and arrays] are universal data structures. Virtually all modern programming languages support them in one form or another. It makes sense that a data format that is interchangeable with programming languages is also based on these structures. (&lt;a href=&quot;https://www.json.org/json-en.html&quot;&gt;Source&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;To explore the JSON syntax further, create a new file named &lt;code&gt;hello_frieda.json&lt;/code&gt; and add a more complex JSON structure as the content of the file:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;json&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--purple&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;JSON&lt;/span&gt;
    &lt;span class=&quot;mr-2&quot; aria-label=&quot;Filename&quot;&gt;&lt;code style=&quot;color: inherit; background: inherit;&quot;&gt;hello_frieda.json&lt;/code&gt;&lt;/span&gt;
    &lt;div class=&quot;noselect&quot;&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;linenos&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 2&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Frieda&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 3&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;isDog&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 4&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;hobbies&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;eating&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;sleeping&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;barking&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 5&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;age&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 6&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;address&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 7&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;work&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;kc&quot;&gt;null&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 8&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;home&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Berlin&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Germany&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 9&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;friends&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;11&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;12&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Philipp&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;13&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;hobbies&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;eating&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;sleeping&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;reading&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;14&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;15&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;16&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;name&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Mitch&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;17&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;      &lt;/span&gt;&lt;span class=&quot;nt&quot;&gt;&quot;hobbies&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;running&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;snacking&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;18&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;19&lt;/span&gt;&lt;span class=&quot;w&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;20&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;In the code above, you see data about a dog named Frieda, which is formatted as JSON. The top-level value is a JSON object. Just like Python dictionaries, you wrap JSON objects inside curly braces (&lt;code&gt;{}&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;In line 1, you start the JSON object with an opening curly brace (&lt;code&gt;{&lt;/code&gt;), and then you close the object at the end of line 20 with a closing curly brace (&lt;code&gt;}&lt;/code&gt;).&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-json/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-json/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Using Python&#x27;s pip to Manage Your Projects&#x27; Dependencies</title>
      <id>https://realpython.com/what-is-pip/</id>
      <link href="https://realpython.com/what-is-pip/"/>
      <updated>2024-12-22T14:00:00+00:00</updated>
      <summary>What is pip? In this beginner-friendly tutorial, you&#x27;ll learn how to use pip, the standard package manager for Python, so that you can install and manage packages that aren&#x27;t part of the Python standard library.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;&lt;code&gt;pip&lt;/code&gt; is the standard package manager for Python, used to install and manage libraries that aren’t part of the Python standard library. You use &lt;code&gt;pip&lt;/code&gt; to manage dependencies and install packages from the Python Package Index (PyPI).&lt;/p&gt;
&lt;p&gt;You can verify if you have &lt;code&gt;pip&lt;/code&gt; by using commands like &lt;code&gt;where pip3&lt;/code&gt; on Windows or &lt;code&gt;which pip3&lt;/code&gt; on Linux and macOS. To install packages listed in a &lt;code&gt;requirements.txt&lt;/code&gt; file, use the command &lt;code&gt;pip install -r requirements.txt&lt;/code&gt;. This ensures your environment replicates the specified dependencies, maintaining consistency across different setups.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this tutorial, you’ll understand that:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;pip&lt;/code&gt; stands for &lt;strong&gt;“pip installs packages”&lt;/strong&gt;, indicating its primary function.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pip&lt;/code&gt; &lt;strong&gt;manages Python packages&lt;/strong&gt; that aren’t part of the standard library.&lt;/li&gt;
&lt;li&gt;You should use &lt;code&gt;pip&lt;/code&gt; whenever you need &lt;strong&gt;external Python packages&lt;/strong&gt; for your projects.&lt;/li&gt;
&lt;li&gt;You can &lt;strong&gt;install and uninstall packages&lt;/strong&gt; with &lt;code&gt;pip&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;You use &lt;strong&gt;requirements files&lt;/strong&gt; to manage projects’ dependencies.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can do a lot with &lt;code&gt;pip&lt;/code&gt;, but the Python community is very active and has created some neat alternatives to &lt;code&gt;pip&lt;/code&gt;. You’ll learn about those later in this tutorial.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Your Cheat Sheet:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/what-is-pip-pdf/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-what-is-pip-pdf&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download a free pip cheat sheet&lt;/a&gt; that summarizes the most important pip commands.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;container border rounded text-wrap-pretty my-3&quot;&gt;

  &lt;p class=&quot;my-3&quot;&gt;&lt;mark class=&quot;marker-highlight&quot;&gt;&lt;strong&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt; Take the Quiz:&lt;/strong&gt;&lt;/mark&gt; Test your knowledge with our interactive “Using Python&#x27;s pip to Manage Your Projects&#x27; Dependencies” quiz. You’ll receive a score upon completion to help you track your learning progress:&lt;/p&gt;

  &lt;hr&gt;

  &lt;div class=&quot;row my-3&quot;&gt;
    &lt;div class=&quot;col-xs-12 col-sm-4 col-md-3 align-self-center&quot;&gt;

      &lt;a href=&quot;/quizzes/what-is-pip/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 embed-responsive-item rounded&quot; style=&quot;object-fit: contain; background: #abe0e6;&quot; alt=&quot;Using Python&#x27;s pip to Manage Your Projects&#x27; Dependencies&quot; src=&quot;https://files.realpython.com/media/What-is-PIP_Watermarked.4944e95d83ad.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/What-is-PIP_Watermarked.4944e95d83ad.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/What-is-PIP_Watermarked.4944e95d83ad.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/What-is-PIP_Watermarked.4944e95d83ad.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/What-is-PIP_Watermarked.4944e95d83ad.jpg 1920w&quot; sizes=&quot;(min-width: 1200px) 142px, (min-width: 1000px) 122px, (min-width: 780px) 112px, (min-width: 580px) 139px, calc(100vw - 62px)&quot;&gt;


          &lt;div class=&quot;card-img-overlay d-flex align-items-center&quot;&gt;
            &lt;div class=&quot;mx-auto&quot;&gt;
              &lt;span class=&quot;text-light&quot; style=&quot;opacity: 0.90;&quot;&gt;&lt;span class=&quot;icon baseline scale2x&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/a&gt;

    &lt;/div&gt;
    &lt;div class=&quot;col&quot;&gt;
      &lt;div class=&quot;mt-3 d-md-none&quot;&gt;&lt;/div&gt; 
      &lt;p class=&quot;small text-muted mb-0&quot;&gt;&lt;strong&gt;Interactive Quiz&lt;/strong&gt;&lt;/p&gt;
      &lt;a href=&quot;/quizzes/what-is-pip/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Using Python&#x27;s pip to Manage Your Projects&#x27; Dependencies&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;In this quiz, you&#x27;ll test your understanding of Python&#x27;s standard package manager, pip. You&#x27;ll revisit the ideas behind pip, important commands, and how to install packages.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;getting-started-with-pip&quot;&gt;Getting Started With &lt;code&gt;pip&lt;/code&gt;&lt;a class=&quot;headerlink&quot; href=&quot;#getting-started-with-pip&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;So, what exactly does &lt;code&gt;pip&lt;/code&gt; do? &lt;a href=&quot;https://pip.pypa.io/en/stable/&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/a&gt; is a &lt;strong&gt;package manager&lt;/strong&gt; for Python. That means it’s a tool that allows you to install and manage libraries and dependencies that aren’t distributed as part of the standard library. The name &lt;strong&gt;pip&lt;/strong&gt; was introduced by Ian Bicking in 2008:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;I’ve finished renaming pyinstall to its new name: pip. The name pip is [an] acronym and declaration: pip installs packages. (&lt;a href=&quot;https://www.ianbicking.org/blog/2008/10/pyinstall-is-dead-long-live-pip.html&quot;&gt;Source&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Package management is so important that Python’s installers have included &lt;code&gt;pip&lt;/code&gt; since versions 3.4 and 2.7.9, for Python 3 and Python 2, respectively. Many Python projects use &lt;code&gt;pip&lt;/code&gt;, which makes it an essential tool for every Pythonista.&lt;/p&gt;
&lt;p&gt;The concept of a package manager might be familiar to you if you’re coming from another programming language. &lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript&quot;&gt;JavaScript&lt;/a&gt; uses &lt;a href=&quot;https://www.npmjs.com/&quot;&gt;npm&lt;/a&gt; for package management, &lt;a href=&quot;https://www.ruby-lang.org/en/&quot;&gt;Ruby&lt;/a&gt; uses &lt;a href=&quot;https://rubygems.org/&quot;&gt;gem&lt;/a&gt;, and the &lt;a href=&quot;https://dotnet.microsoft.com/languages&quot;&gt;.NET platform&lt;/a&gt; uses &lt;a href=&quot;https://www.nuget.org/&quot;&gt;NuGet&lt;/a&gt;. In Python, &lt;code&gt;pip&lt;/code&gt; has become the standard package manager.&lt;/p&gt;
&lt;h3 id=&quot;finding-pip-on-your-system&quot;&gt;Finding &lt;code&gt;pip&lt;/code&gt; on Your System&lt;a class=&quot;headerlink&quot; href=&quot;#finding-pip-on-your-system&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;The Python installer gives you the option to install &lt;code&gt;pip&lt;/code&gt; when installing Python on your system. In fact, the option to install &lt;code&gt;pip&lt;/code&gt; with Python is checked by default, so &lt;code&gt;pip&lt;/code&gt; should be ready for you to use after installing Python.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; On some Linux (Unix) systems like Ubuntu, &lt;code&gt;pip&lt;/code&gt; comes in a separate package called &lt;code&gt;python3-pip&lt;/code&gt;, which you need to install with &lt;code&gt;sudo apt install python3-pip&lt;/code&gt;. It’s not installed by default with the interpreter.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;You can verify that &lt;code&gt;pip&lt;/code&gt; is available by looking for the &lt;code&gt;pip3&lt;/code&gt; executable on your system. Select your operating system below and use your platform-specific command accordingly:&lt;/p&gt;
&lt;ul class=&quot;nav nav-tabs justify-content-end js-platform-widget-tabs&quot; role=&quot;tablist&quot;&gt;

  &lt;li class=&quot;nav-item mb-0 js-platform-widget-tab-windows&quot; role=&quot;presentation&quot;&gt;
    &lt;a class=&quot;nav-link link-unstyled text-body active small&quot; id=&quot;windows-tab-1&quot; data-toggle=&quot;tab&quot; href=&quot;#windows-1&quot; role=&quot;tab&quot; aria-controls=&quot;windows-1&quot; aria-selected=&quot;true&quot;&gt;&lt;span class=&quot;icon baseline text-muted mr-1&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#brands--windows&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Windows&lt;/a&gt;
  &lt;/li&gt;




  &lt;li class=&quot;nav-item mb-0 js-platform-widget-tab-linuxmacos&quot; role=&quot;presentation&quot;&gt;
    &lt;a class=&quot;nav-link link-unstyled text-body small&quot; id=&quot;macos-tab-1&quot; data-toggle=&quot;tab&quot; href=&quot;#linux-macos-1&quot; role=&quot;tab&quot; aria-controls=&quot;linux-macos-1&quot; aria-selected=&quot;false&quot;&gt;&lt;span class=&quot;icon baseline text-muted&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#v4--linux&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;span class=&quot;icon baseline text-muted mr-1&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#v4--apple&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Linux + macOS&lt;/a&gt;
  &lt;/li&gt;

&lt;/ul&gt;
&lt;div class=&quot;tab-content mt-2 mb-0 js-platform-widget-content&quot;&gt;
&lt;div aria-labelledby=&quot;windows-tab-1&quot; class=&quot;tab-pane fade show active&quot; id=&quot;windows-1&quot; role=&quot;tabpanel&quot;&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pscon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Windows PowerShell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;PS&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;where &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;pip3&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;where&lt;/code&gt; command on Windows will show you where you can find the executable of &lt;code&gt;pip3&lt;/code&gt;. If Windows can’t find an executable named &lt;code&gt;pip3&lt;/code&gt;, then you can also try looking for &lt;code&gt;pip&lt;/code&gt; without the three (&lt;code&gt;3&lt;/code&gt;) at the end.&lt;/p&gt;
&lt;/div&gt;
&lt;div aria-labelledby=&quot;linux-macos-tab-1&quot; class=&quot;tab-pane fade &quot; id=&quot;linux-macos-1&quot; role=&quot;tabpanel&quot;&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;console&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Shell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;which&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;pip3
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;which&lt;/code&gt; command on Linux systems and macOS shows you where the &lt;code&gt;pip3&lt;/code&gt; binary file is located.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;On Windows and Unix systems, &lt;code&gt;pip3&lt;/code&gt; may be found in more than one location. This can happen when you have multiple Python versions installed. If you can’t find &lt;code&gt;pip&lt;/code&gt; in any location on your system, then you may consider &lt;a href=&quot;#reinstalling-pip-when-errors-occur&quot;&gt;reinstalling pip&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Instead of running your system &lt;code&gt;pip&lt;/code&gt; directly, you can also run it as a Python module. In the next section, you’ll learn how.&lt;/p&gt;
&lt;h3 id=&quot;running-pip-as-a-module&quot;&gt;Running &lt;code&gt;pip&lt;/code&gt; as a Module&lt;a class=&quot;headerlink&quot; href=&quot;#running-pip-as-a-module&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;When you run your system &lt;code&gt;pip&lt;/code&gt; directly, the command itself doesn’t reveal which Python version &lt;code&gt;pip&lt;/code&gt; belongs to. This unfortunately means that you could use &lt;code&gt;pip&lt;/code&gt; to install a package into the site-packages of an old Python version without noticing. To prevent this from happening, you should run &lt;code&gt;pip&lt;/code&gt; as a Python module:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;console&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Shell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;-m&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;pip
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Notice that you use &lt;code&gt;python -m&lt;/code&gt; to run &lt;code&gt;pip&lt;/code&gt;. The &lt;code&gt;-m&lt;/code&gt; switch tells Python to run a module as an executable of the &lt;code&gt;python&lt;/code&gt; interpreter. This way, you can ensure that your system default Python version runs the &lt;code&gt;pip&lt;/code&gt; command. If you want to learn more about this way of running &lt;code&gt;pip&lt;/code&gt;, then you can read Brett Cannon’s insightful article about &lt;a href=&quot;https://snarky.ca/why-you-should-use-python-m-pip/&quot;&gt;the advantages of using &lt;code&gt;python -m pip&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Depending on how you installed Python, your Python executable may have a different name than &lt;code&gt;python&lt;/code&gt;. You’ll see &lt;code&gt;python&lt;/code&gt; used in this tutorial, but you may have to adapt the commands to use something like &lt;code&gt;py&lt;/code&gt; or &lt;code&gt;python3&lt;/code&gt; instead.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/what-is-pip/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/what-is-pip/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>A Practical Introduction to Web Scraping in Python</title>
      <id>https://realpython.com/python-web-scraping-practical-introduction/</id>
      <link href="https://realpython.com/python-web-scraping-practical-introduction/"/>
      <updated>2024-12-21T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn all about web scraping in Python. You&#x27;ll see how to parse data from websites and interact with HTML forms using tools such as Beautiful Soup and MechanicalSoup.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Python web scraping allows you to collect and parse data from websites programmatically. With powerful libraries like &lt;code&gt;urllib&lt;/code&gt;, Beautiful Soup, and MechanicalSoup, you can fetch and manipulate HTML content effortlessly. By automating data collection tasks, Python makes web scraping both efficient and effective.&lt;/p&gt;
&lt;p&gt;You can build a Python web scraping workflow using only the standard library by fetching a web page with &lt;code&gt;urllib&lt;/code&gt; and extracting data using string methods or regular expressions. For more complex HTML or more robust workflows, you can use the third-party library Beautiful Soup, which simplifies HTML parsing. By adding MechanicalSoup to your toolkit, you can even enable interactions with HTML forms.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this tutorial, you’ll understand that:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Python is &lt;strong&gt;well-suited for web scraping&lt;/strong&gt; due to its &lt;strong&gt;extensive libraries&lt;/strong&gt;, such as Beautiful Soup and MechanicalSoup.&lt;/li&gt;
&lt;li&gt;You can scrape websites with Python by &lt;strong&gt;fetching HTML content&lt;/strong&gt; using &lt;code&gt;urllib&lt;/code&gt; and &lt;strong&gt;extracting data&lt;/strong&gt; using string methods or parsers like Beautiful Soup.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Beautiful Soup&lt;/strong&gt; is a great choice for &lt;strong&gt;parsing HTML&lt;/strong&gt; documents with Python effectively.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Data scraping may be illegal&lt;/strong&gt; if it violates a website’s terms of use, so always review the website’s acceptable use policy.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This tutorial guides you through extracting data from websites using string methods, regular expressions, and HTML parsers.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; This tutorial is adapted from the chapter “Interacting With the Web” in &lt;a href=&quot;https://realpython.com/products/python-basics-book/&quot;&gt;&lt;em&gt;Python Basics: A Practical Introduction to Python 3&lt;/em&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The book uses Python’s built-in &lt;a href=&quot;https://realpython.com/python-idle/&quot;&gt;IDLE&lt;/a&gt; editor to create and edit Python files and interact with the Python shell, so you’ll see occasional references to IDLE throughout this tutorial. However, you should have no problems running the example code from the &lt;a href=&quot;https://realpython.com/python-ides-code-editors-guide/&quot;&gt;editor&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/effective-python-environment/&quot;&gt;environment&lt;/a&gt; of your choice.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Source Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-web-scraping-practical-introduction-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-web-scraping-practical-introduction-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free source code&lt;/a&gt; that you’ll use to collect and parse data from the Web.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;container border rounded text-wrap-pretty my-3&quot;&gt;

  &lt;p class=&quot;my-3&quot;&gt;&lt;mark class=&quot;marker-highlight&quot;&gt;&lt;strong&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt; Take the Quiz:&lt;/strong&gt;&lt;/mark&gt; Test your knowledge with our interactive “A Practical Introduction to Web Scraping in Python” quiz. You’ll receive a score upon completion to help you track your learning progress:&lt;/p&gt;

  &lt;hr&gt;

  &lt;div class=&quot;row my-3&quot;&gt;
    &lt;div class=&quot;col-xs-12 col-sm-4 col-md-3 align-self-center&quot;&gt;

      &lt;a href=&quot;/quizzes/python-web-scraping-practical-introduction/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 embed-responsive-item rounded&quot; style=&quot;object-fit: contain; background: #abe5b2;&quot; alt=&quot;Web Scraping in Python&quot; src=&quot;https://files.realpython.com/media/Python-Basics-Chapter-on-Web-Scraping_Watermarked.f8d56f56c22c.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/Python-Basics-Chapter-on-Web-Scraping_Watermarked.f8d56f56c22c.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Python-Basics-Chapter-on-Web-Scraping_Watermarked.f8d56f56c22c.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Python-Basics-Chapter-on-Web-Scraping_Watermarked.f8d56f56c22c.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Python-Basics-Chapter-on-Web-Scraping_Watermarked.f8d56f56c22c.jpg 1920w&quot; sizes=&quot;(min-width: 1200px) 142px, (min-width: 1000px) 122px, (min-width: 780px) 112px, (min-width: 580px) 139px, calc(100vw - 62px)&quot;&gt;


          &lt;div class=&quot;card-img-overlay d-flex align-items-center&quot;&gt;
            &lt;div class=&quot;mx-auto&quot;&gt;
              &lt;span class=&quot;text-light&quot; style=&quot;opacity: 0.90;&quot;&gt;&lt;span class=&quot;icon baseline scale2x&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/a&gt;

    &lt;/div&gt;
    &lt;div class=&quot;col&quot;&gt;
      &lt;div class=&quot;mt-3 d-md-none&quot;&gt;&lt;/div&gt; 
      &lt;p class=&quot;small text-muted mb-0&quot;&gt;&lt;strong&gt;Interactive Quiz&lt;/strong&gt;&lt;/p&gt;
      &lt;a href=&quot;/quizzes/python-web-scraping-practical-introduction/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;A Practical Introduction to Web Scraping in Python&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;In this quiz, you&#x27;ll test your understanding of web scraping in Python. Web scraping is a powerful tool for data collection and analysis. By working through this quiz, you&#x27;ll revisit how to parse website data using string methods, regular expressions, and HTML parsers, as well as how to interact with forms and other website components.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;scrape-and-parse-text-from-websites&quot;&gt;Scrape and Parse Text From Websites&lt;a class=&quot;headerlink&quot; href=&quot;#scrape-and-parse-text-from-websites&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Collecting data from websites using an automated process is known as web scraping. Some websites explicitly forbid users from scraping their data with automated tools like the ones that you’ll create in this tutorial. Websites do this for two possible reasons:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The site has a good reason to protect its data. For instance, Google Maps doesn’t let you request too many results too quickly.&lt;/li&gt;
&lt;li&gt;Making many repeated requests to a website’s server may use up bandwidth, slowing down the website for other users and potentially overloading the server such that the website stops responding entirely.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Before using your Python skills for web scraping, you should always check your target website’s acceptable use policy to see if accessing the website with automated tools is a violation of its terms of use. Legally, web scraping against the wishes of a website is very much a gray area.&lt;/p&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;Important:&lt;/strong&gt; Please be aware that the following techniques &lt;a href=&quot;https://en.wikipedia.org/wiki/Web_scraping#Legal_issues&quot;&gt;may be illegal&lt;/a&gt; when used on websites that prohibit web scraping.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;For this tutorial, you’ll use a page that’s hosted on Real Python’s server. The page that you’ll access has been set up for use with this tutorial. &lt;/p&gt;
&lt;p&gt;Now that you’ve read the disclaimer, you can get to the fun stuff. In the next section, you’ll start grabbing all the HTML code from a single web page.&lt;/p&gt;
&lt;h3 id=&quot;build-your-first-web-scraper&quot;&gt;Build Your First Web Scraper&lt;a class=&quot;headerlink&quot; href=&quot;#build-your-first-web-scraper&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;One useful package for web scraping that you can find in Python’s &lt;a href=&quot;https://docs.python.org/3/library/&quot;&gt;standard library&lt;/a&gt; is &lt;code&gt;urllib&lt;/code&gt;, which contains tools for working with URLs. In particular, the &lt;a href=&quot;https://realpython.com/urllib-request/&quot;&gt;&lt;code&gt;urllib.request&lt;/code&gt;&lt;/a&gt; module contains a function called &lt;code&gt;urlopen()&lt;/code&gt; that you can use to open a URL within a program.&lt;/p&gt;
&lt;p&gt;In IDLE’s interactive window, type the following to import &lt;code&gt;urlopen()&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;kn&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;urllib.request&lt;/span&gt; &lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;urlopen&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The web page that you’ll open is at the following URL:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;url&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;http://olympus.realpython.org/profiles/aphrodite&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;To open the web page, pass &lt;code&gt;url&lt;/code&gt; to &lt;code&gt;urlopen()&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;page&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;urlopen&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;code&gt;urlopen()&lt;/code&gt; returns an &lt;code&gt;HTTPResponse&lt;/code&gt; object:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;page&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&amp;lt;http.client.HTTPResponse object at 0x105fef820&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-web-scraping-practical-introduction/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-web-scraping-practical-introduction/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Basic Data Types in Python: A Quick Exploration</title>
      <id>https://realpython.com/python-data-types/</id>
      <link href="https://realpython.com/python-data-types/"/>
      <updated>2024-12-21T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn about the basic data types that are built into Python, including numbers, strings, bytes, and Booleans.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Python data types are fundamental to the language, enabling you to represent various kinds of data. You use basic data types like &lt;strong&gt;&lt;code&gt;int&lt;/code&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;code&gt;float&lt;/code&gt;&lt;/strong&gt;, and &lt;strong&gt;&lt;code&gt;complex&lt;/code&gt;&lt;/strong&gt; for numbers, &lt;strong&gt;&lt;code&gt;str&lt;/code&gt;&lt;/strong&gt; for text, &lt;strong&gt;&lt;code&gt;bytes&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;bytearray&lt;/code&gt;&lt;/strong&gt; for binary data, and &lt;strong&gt;&lt;code&gt;bool&lt;/code&gt;&lt;/strong&gt; for Boolean values. These data types form the core of most Python programs, allowing you to handle numeric, textual, and logical data efficiently.&lt;/p&gt;
&lt;p&gt;Understanding Python data types involves recognizing their roles and how to work with them. You can create and manipulate these data types using built-in functions and methods. You can also convert between them when necessary. This versatility helps you manage data effectively in your Python projects.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this tutorial, you’ll understand that:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Python’s &lt;strong&gt;basic data types&lt;/strong&gt; include &lt;code&gt;int&lt;/code&gt;, &lt;code&gt;float&lt;/code&gt;, &lt;code&gt;complex&lt;/code&gt;, &lt;code&gt;str&lt;/code&gt;, &lt;code&gt;bytes&lt;/code&gt;, &lt;code&gt;bytearray&lt;/code&gt;, and &lt;code&gt;bool&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;You can &lt;strong&gt;check a variable’s type&lt;/strong&gt; using the &lt;strong&gt;&lt;code&gt;type()&lt;/code&gt; function&lt;/strong&gt; in Python.&lt;/li&gt;
&lt;li&gt;You can &lt;strong&gt;convert data types&lt;/strong&gt; in Python using functions like &lt;code&gt;int()&lt;/code&gt;, &lt;code&gt;float()&lt;/code&gt;, &lt;code&gt;str()&lt;/code&gt;, and others.&lt;/li&gt;
&lt;li&gt;Despite being &lt;strong&gt;dynamically typed&lt;/strong&gt;, Python does have data types.&lt;/li&gt;
&lt;li&gt;The most essential data types in Python can be categorized as &lt;strong&gt;numeric&lt;/strong&gt;, &lt;strong&gt;sequence&lt;/strong&gt;, &lt;strong&gt;binary&lt;/strong&gt;, and &lt;strong&gt;Boolean&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In this tutorial, you’ll learn only the basics of each data type. To learn more about a specific data type, you’ll find useful resources in the corresponding section.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/python-data-types-update-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-data-types-update-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free sample code&lt;/a&gt; that you’ll use to learn about basic data types in Python.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;container border rounded text-wrap-pretty my-3&quot;&gt;

  &lt;p class=&quot;my-3&quot;&gt;&lt;mark class=&quot;marker-highlight&quot;&gt;&lt;strong&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt; Take the Quiz:&lt;/strong&gt;&lt;/mark&gt; Test your knowledge with our interactive “Basic Data Types in Python: A Quick Exploration” quiz. You’ll receive a score upon completion to help you track your learning progress:&lt;/p&gt;

  &lt;hr&gt;

  &lt;div class=&quot;row my-3&quot;&gt;
    &lt;div class=&quot;col-xs-12 col-sm-4 col-md-3 align-self-center&quot;&gt;

      &lt;a href=&quot;/quizzes/python-data-types/&quot; tabindex=&quot;-1&quot;&gt;
        &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot;&gt;

            &lt;img class=&quot;card-img-top m-0 p-0 embed-responsive-item rounded&quot; style=&quot;object-fit: contain; background: #e5c5ac;&quot; alt=&quot;Basic Data Types in Python&quot; src=&quot;https://files.realpython.com/media/Basic-Data-Types-in-Python_Watermarked.e3dd34457952.jpg&quot; width=&quot;1920&quot; height=&quot;1080&quot; srcset=&quot;/cdn-cgi/image/width=480,format=auto/https://files.realpython.com/media/Basic-Data-Types-in-Python_Watermarked.e3dd34457952.jpg 480w, /cdn-cgi/image/width=640,format=auto/https://files.realpython.com/media/Basic-Data-Types-in-Python_Watermarked.e3dd34457952.jpg 640w, /cdn-cgi/image/width=960,format=auto/https://files.realpython.com/media/Basic-Data-Types-in-Python_Watermarked.e3dd34457952.jpg 960w, /cdn-cgi/image/width=1920,format=auto/https://files.realpython.com/media/Basic-Data-Types-in-Python_Watermarked.e3dd34457952.jpg 1920w&quot; sizes=&quot;(min-width: 1200px) 142px, (min-width: 1000px) 122px, (min-width: 780px) 112px, (min-width: 580px) 139px, calc(100vw - 62px)&quot;&gt;


          &lt;div class=&quot;card-img-overlay d-flex align-items-center&quot;&gt;
            &lt;div class=&quot;mx-auto&quot;&gt;
              &lt;span class=&quot;text-light&quot; style=&quot;opacity: 0.90;&quot;&gt;&lt;span class=&quot;icon baseline scale2x&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@quiz&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/a&gt;

    &lt;/div&gt;
    &lt;div class=&quot;col&quot;&gt;
      &lt;div class=&quot;mt-3 d-md-none&quot;&gt;&lt;/div&gt; 
      &lt;p class=&quot;small text-muted mb-0&quot;&gt;&lt;strong&gt;Interactive Quiz&lt;/strong&gt;&lt;/p&gt;
      &lt;a href=&quot;/quizzes/python-data-types/&quot; class=&quot;stretched-link&quot;&gt;&lt;span class=&quot;my-0 h4&quot;&gt;Basic Data Types in Python: A Quick Exploration&lt;/span&gt;&lt;/a&gt; 
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;Take this quiz to test your understanding of the basic data types that are built into Python, like numbers, strings, bytes, and Booleans.&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;

&lt;/div&gt;

&lt;h2 id=&quot;pythons-basic-data-types&quot;&gt;Python’s Basic Data Types&lt;a class=&quot;headerlink&quot; href=&quot;#pythons-basic-data-types&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Python has several &lt;strong&gt;built-in data types&lt;/strong&gt; that you can use out of the box because they’re built into the language. From all the built-in types available, you’ll find that a few of them represent &lt;em&gt;basic&lt;/em&gt; objects, such as numbers, strings and characters, bytes, and Boolean values.&lt;/p&gt;
&lt;p&gt;Note that the term &lt;strong&gt;basic&lt;/strong&gt; refers to objects that can represent data you typically find in real life, such as numbers and text. It doesn’t include composite data types, such as &lt;a href=&quot;https://realpython.com/python-list/&quot;&gt;lists&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-tuple/&quot;&gt;tuples&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-dicts/&quot;&gt;dictionaries&lt;/a&gt;, and others.&lt;/p&gt;
&lt;p&gt;In Python, the built-in data types that you can consider basic are the following:&lt;/p&gt;
&lt;div class=&quot;table-responsive&quot;&gt;
&lt;table class=&quot;table table-hover&quot;&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Class&lt;/th&gt;
&lt;th&gt;Basic Type&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href=&quot;#integer-numbers&quot;&gt;&lt;code&gt;int&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Integer numbers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href=&quot;#floating-point-numbers&quot;&gt;&lt;code&gt;float&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Floating-point numbers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href=&quot;#complex-numbers&quot;&gt;&lt;code&gt;complex&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Complex numbers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href=&quot;#strings-and-characters&quot;&gt;&lt;code&gt;str&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Strings and characters&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href=&quot;#bytes-and-bytearrays&quot;&gt;&lt;code&gt;bytes&lt;/code&gt;, &lt;code&gt;bytearray&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Bytes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href=&quot;#booleans&quot;&gt;&lt;code&gt;bool&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Boolean values&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;In the following sections, you’ll learn the basics of how to create, use, and work with all of these built-in data types in Python.&lt;/p&gt;
&lt;h2 id=&quot;integer-numbers&quot;&gt;Integer Numbers&lt;a class=&quot;headerlink&quot; href=&quot;#integer-numbers&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Integer numbers&lt;/strong&gt; are whole numbers with no decimal places. They can be positive or negative numbers. For example, &lt;code&gt;0&lt;/code&gt;, &lt;code&gt;1&lt;/code&gt;, &lt;code&gt;2&lt;/code&gt;, &lt;code&gt;3&lt;/code&gt;, &lt;code&gt;-1&lt;/code&gt;, &lt;code&gt;-2&lt;/code&gt;, and &lt;code&gt;-3&lt;/code&gt; are all integers. Usually, you’ll use positive integer numbers to count things.&lt;/p&gt;
&lt;p&gt;In Python, the integer data type is represented by the &lt;a href=&quot;https://docs.python.org/3/library/functions.html#int&quot;&gt;&lt;code&gt;int&lt;/code&gt;&lt;/a&gt; class:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;42&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;&amp;lt;class &#x27;int&#x27;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;In the following sections, you’ll learn the basics of how to create and work with integer numbers in Python.&lt;/p&gt;
&lt;h3 id=&quot;integer-literals&quot;&gt;Integer Literals&lt;a class=&quot;headerlink&quot; href=&quot;#integer-literals&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;When you need to use integer numbers in your code, you’ll often use integer &lt;a href=&quot;https://docs.python.org/3/reference/lexical_analysis.html#literals&quot;&gt;literals&lt;/a&gt; directly. Literals are constant values of built-in types spelled out literally, such as integers. Python provides a few different ways to create integer literals. The most common way is to use base-ten literals that look the same as integers look in math:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;42&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;42&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;84&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;-84&lt;/span&gt;

&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;0&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Here, you have three integer numbers: a positive one, a negative one, and zero. Note that to create negative integers, you need to prepend the minus sign (&lt;code&gt;-&lt;/code&gt;) to the number.&lt;/p&gt;
&lt;p&gt;Python has no limit to how long an integer value can be. The only constraint is the amount of memory your system has. Beyond that, an integer can be as long as you need:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pycon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;123123123123123123123123123123123123123123123123&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;123123123123123123123123123123123123123123123124&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;For a really, really long integer, you &lt;a href=&quot;https://realpython.com/python-news-september-2022/#python-introduced-a-breaking-change-to-fix-a-vulnerability&quot;&gt;can get a &lt;code&gt;ValueError&lt;/code&gt;&lt;/a&gt; when converting it to a string:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-data-types/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-data-types/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #232: Exploring Modern Sentiment Analysis Approaches in Python</title>
      <id>https://realpython.com/podcasts/rpp/232/</id>
      <link href="https://realpython.com/podcasts/rpp/232/"/>
      <updated>2024-12-20T12:00:00+00:00</updated>
      <summary>What are the current approaches for analyzing emotions within a piece of text? Which tools and Python packages should you use for sentiment analysis? This week, Jodie Burchell, developer advocate for data science at JetBrains, returns to the show to discuss modern sentiment analysis in Python.</summary>
      <content type="html">
        &lt;p&gt;What are the current approaches for analyzing emotions within a piece of text? Which tools and Python packages should you use for sentiment analysis? This week, Jodie Burchell, developer advocate for data science at JetBrains, returns to the show to discuss modern sentiment analysis in Python.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Get Started With Django User Management</title>
      <id>https://realpython.com/django-user-management/</id>
      <link href="https://realpython.com/django-user-management/"/>
      <updated>2024-12-18T14:00:00+00:00</updated>
      <summary>In this step-by-step tutorial, you&#x27;ll learn how to extend your Django application with a user management system.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Django user management allows you to integrate user authentication and management into your web applications. By using Django, you can leverage the framework’s built-in authentication system to manage user registration, login, and logout. With just a few additional templates, you can enable users to reset and change their passwords independently. &lt;/p&gt;
&lt;p&gt;This tutorial guides you through setting up a basic user management system with Django that you can extend later. You’ll learn how to create a dashboard, implement user registration, and connect authentication URLs, as well as customize templates for login, logout, and password management. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;By the end of this tutorial, you’ll understand that:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Django’s user authentication&lt;/strong&gt; is a built-in authentication system that comes with pre-configured URLs and views.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Authentication&lt;/strong&gt; verifies user identity, while &lt;strong&gt;authorization&lt;/strong&gt; determines user permissions within Django.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Registering as a user&lt;/strong&gt; in Django requires setting up views, templates, and URLs.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Creating a login system&lt;/strong&gt; in Django involves built-in authentication views and creating custom templates.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Resetting passwords&lt;/strong&gt; in Django involves configuring email backends for sending reset links.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This tutorial focuses on user authentication and user management. If you want to learn more about &lt;a href=&quot;https://docs.djangoproject.com/en/5.1/topics/auth/default/#permissions-and-authorization&quot;&gt;permissions and groups&lt;/a&gt;, then you can check out the tutorial about &lt;a href=&quot;https://realpython.com/manage-users-in-django-admin/&quot;&gt;managing users in Django’s admin site&lt;/a&gt;.&lt;/p&gt;
&lt;div class=&quot;alert alert-warning&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong markdown=&quot;1&quot;&gt;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/django-user-management-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-django-user-management-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free sample code&lt;/a&gt; you’ll use to set up a basic user management system with Django .&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;start-with-the-basics&quot;&gt;Start With the Basics&lt;a class=&quot;headerlink&quot; href=&quot;#start-with-the-basics&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;For bigger projects, you may consider creating a &lt;a href=&quot;https://docs.djangoproject.com/en/5.1/topics/auth/customizing/#using-a-custom-user-model-when-starting-a-project&quot;&gt;custom user model&lt;/a&gt;. In this tutorial, you’ll be using Django’s built-in user model. This is a great place to start to familiarize yourself with user authentication in general.&lt;/p&gt;
&lt;p&gt;In this section of the tutorial, you’ll first create a small Django project with a &lt;code&gt;users&lt;/code&gt; app. Then, you’ll make some adjustments to Django’s password validator to make your development more convenient. Finally, you’ll create an admin user to verify your setup.&lt;/p&gt;
&lt;h3 id=&quot;set-up-the-django-project&quot;&gt;Set Up the Django Project&lt;a class=&quot;headerlink&quot; href=&quot;#set-up-the-django-project&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;It’s a good idea to use a virtual environment when working with Python projects. That way, you can always be sure that the &lt;code&gt;python&lt;/code&gt; command points to the right version of Python and that the modules required by your project have the correct versions. To read more about creating virtual environments, check out &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;Python Virtual Environments: A Primer&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Select your &lt;strong&gt;operating system&lt;/strong&gt; below and use your platform-specific command to set up a virtual environment:&lt;/p&gt;
&lt;ul class=&quot;nav nav-tabs justify-content-end js-platform-widget-tabs&quot; role=&quot;tablist&quot;&gt;

  &lt;li class=&quot;nav-item mb-0 js-platform-widget-tab-windows&quot; role=&quot;presentation&quot;&gt;
    &lt;a class=&quot;nav-link link-unstyled text-body active small&quot; id=&quot;windows-tab-1&quot; data-toggle=&quot;tab&quot; href=&quot;#windows-1&quot; role=&quot;tab&quot; aria-controls=&quot;windows-1&quot; aria-selected=&quot;true&quot;&gt;&lt;span class=&quot;icon baseline text-muted mr-1&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#brands--windows&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Windows&lt;/a&gt;
  &lt;/li&gt;




  &lt;li class=&quot;nav-item mb-0 js-platform-widget-tab-linuxmacos&quot; role=&quot;presentation&quot;&gt;
    &lt;a class=&quot;nav-link link-unstyled text-body small&quot; id=&quot;macos-tab-1&quot; data-toggle=&quot;tab&quot; href=&quot;#linux-macos-1&quot; role=&quot;tab&quot; aria-controls=&quot;linux-macos-1&quot; aria-selected=&quot;false&quot;&gt;&lt;span class=&quot;icon baseline text-muted&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#v4--linux&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;span class=&quot;icon baseline text-muted mr-1&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#v4--apple&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Linux + macOS&lt;/a&gt;
  &lt;/li&gt;

&lt;/ul&gt;
&lt;div class=&quot;tab-content mt-2 mb-0 js-platform-widget-content&quot;&gt;
&lt;div aria-labelledby=&quot;windows-tab-1&quot; class=&quot;tab-pane fade show active&quot; id=&quot;windows-1&quot; role=&quot;tabpanel&quot;&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;pscon&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Windows PowerShell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;PS&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;python&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;-m&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;venv&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;venv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;\&lt;/span&gt;
&lt;span class=&quot;gp&quot;&gt;PS&amp;gt; &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.\&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;venv&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Scripts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;\&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;activate&lt;/span&gt;
&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;PS&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div aria-labelledby=&quot;linux-macos-tab-1&quot; class=&quot;tab-pane fade &quot; id=&quot;linux-macos-1&quot; role=&quot;tabpanel&quot;&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;console&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Shell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;-m&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;venv&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;venv/
&lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;source&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;venv/bin/activate
&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;$&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;With the above commands, you create and activate a virtual environment named &lt;code&gt;venv&lt;/code&gt; by using Python’s built-in &lt;code&gt;venv&lt;/code&gt; module.
The parenthesized &lt;code&gt;(venv)&lt;/code&gt; in front of the prompt indicate that you’ve successfully activated the virtual environment.&lt;/p&gt;
&lt;p&gt;Now that the environment is ready, you can install Django, start a new project, and create an application to store all your user management code:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;console&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Shell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;-m&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;pip&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;install&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;Django
&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;django-admin&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;startproject&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;user_auth_intro
&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;user_auth_intro
&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;manage.py&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;startapp&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;users
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;In this example, you name your project &lt;code&gt;user_auth_intro&lt;/code&gt; and your application &lt;code&gt;users&lt;/code&gt;. To include the &lt;code&gt;users&lt;/code&gt; app in your Django project, you need to add a reference to the app’s &lt;a href=&quot;https://docs.djangoproject.com/en/5.1/ref/applications/#configuring-applications&quot;&gt;configuration class&lt;/a&gt; at the beginning of the &lt;code&gt;INSTALLED_APPS&lt;/code&gt; list in &lt;code&gt;settings.py&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;python&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--blue&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Python&lt;/span&gt;
    &lt;span class=&quot;mr-2&quot; aria-label=&quot;Filename&quot;&gt;&lt;code style=&quot;color: inherit; background: inherit;&quot;&gt;user_auth_intro/settings.py&lt;/code&gt;&lt;/span&gt;
    &lt;div class=&quot;noselect&quot;&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;linenos&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;# ...&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 2&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 3&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;INSTALLED_APPS&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;
&lt;span class=&quot;hll&quot;&gt;&lt;span class=&quot;linenos&quot;&gt; 4&lt;/span&gt;    &lt;span class=&quot;s2&quot;&gt;&quot;users.apps.UsersConfig&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;/span&gt;&lt;span class=&quot;linenos&quot;&gt; 5&lt;/span&gt;    &lt;span class=&quot;s2&quot;&gt;&quot;django.contrib.admin&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 6&lt;/span&gt;    &lt;span class=&quot;s2&quot;&gt;&quot;django.contrib.auth&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 7&lt;/span&gt;    &lt;span class=&quot;s2&quot;&gt;&quot;django.contrib.contenttypes&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 8&lt;/span&gt;    &lt;span class=&quot;s2&quot;&gt;&quot;django.contrib.sessions&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt; 9&lt;/span&gt;    &lt;span class=&quot;s2&quot;&gt;&quot;django.contrib.messages&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;10&lt;/span&gt;    &lt;span class=&quot;s2&quot;&gt;&quot;django.contrib.staticfiles&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;11&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;12&lt;/span&gt;
&lt;span class=&quot;linenos&quot;&gt;13&lt;/span&gt;&lt;span class=&quot;c1&quot;&gt;# ...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;By adding &lt;code&gt;users.apps.UsersConfig&lt;/code&gt;, you let Django know that the &lt;code&gt;users&lt;/code&gt; app you just created exists. If you have a look at the &lt;code&gt;INSTALLED_APPS&lt;/code&gt; list, then you’ll spot Django’s default &lt;strong&gt;authentication system&lt;/strong&gt; on line 6. In &lt;code&gt;django.contrib.auth&lt;/code&gt;, Django stores the core of its authentication framework and the default models that you’ll build on later.&lt;/p&gt;
&lt;p&gt;Next, apply the &lt;a href=&quot;https://realpython.com/django-migrations-a-primer/&quot;&gt;migrations&lt;/a&gt; and run the Django development server:&lt;/p&gt;
&lt;div class=&quot;codeblock mb-3 w-100&quot; aria-label=&quot;Code block&quot; data-syntax-language=&quot;console&quot; data-is-repl=&quot;true&quot;&gt;
  &lt;div class=&quot;codeblock__header d-flex justify-content-between codeblock--yellow&quot;&gt;
    &lt;span class=&quot;mr-2 noselect&quot; aria-label=&quot;Language&quot;&gt;Shell&lt;/span&gt;
    
    &lt;div class=&quot;noselect&quot;&gt;
      
        &lt;span class=&quot;codeblock__output-toggle&quot; title=&quot;Toggle prompts and output&quot; role=&quot;button&quot;&gt;&lt;span class=&quot;icon baseline js-codeblock-output-on codeblock__header--icon-lower&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#regular--rectangle-terminal&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/span&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div style=&quot;position: relative;&quot;&gt;
    &lt;div class=&quot;highlight highlight--with-header&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;manage.py&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;migrate
&lt;span class=&quot;gp gp-VirtualEnv&quot;&gt;(venv)&lt;/span&gt; &lt;span class=&quot;gp&quot;&gt;$ &lt;/span&gt;python&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;manage.py&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;runserver
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
    
    &lt;button class=&quot;codeblock__copy btn btn-outline-secondary border m-1 px-1 d-hover-only&quot; title=&quot;Copy to clipboard&quot;&gt;&lt;span class=&quot;icon baseline&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@copy&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;&lt;/button&gt;
    &lt;template class=&quot;codeblock__copied-template&quot;&gt;
      &lt;span class=&quot;small&quot;&gt;&lt;span class=&quot;icon baseline mr-1 text-success&quot; aria-hidden=&quot;true&quot;&gt;&lt;svg aria-hidden=&quot;true&quot;&gt;&lt;use href=&quot;/static/icons.fdc7a95d4b34.svg#@check&quot;&gt;&lt;/use&gt;&lt;/svg&gt;&lt;/span&gt;Copied!&lt;/span&gt;
    &lt;/template&gt;
    
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;These commands create all default models in the database and start the Django development server.&lt;/p&gt;
&lt;h3 id=&quot;deactivate-the-password-validator&quot;&gt;Deactivate the Password Validator&lt;a class=&quot;headerlink&quot; href=&quot;#deactivate-the-password-validator&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;By default, Django enforces strong passwords to make user accounts less prone to attacks. Since you’ll need to change passwords often throughout this tutorial, figuring out a strong password each time would be inconvenient. &lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/django-user-management/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/django-user-management/ »&lt;/a&gt;&lt;/h2&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: How to Remove Items From Lists in Python</title>
      <id>https://realpython.com/quizzes/remove-item-from-list-python/</id>
      <link href="https://realpython.com/quizzes/remove-item-from-list-python/"/>
      <updated>2024-12-18T12:00:00+00:00</updated>
      <summary>In this quiz, you&#x27;ll test your understanding of removing items from lists in Python. This is a fundamental skill in Python programming, and mastering it will enable you to manipulate lists effectively.</summary>
      <content type="html">
        &lt;p&gt;In this quiz, you&amp;rsquo;ll test your understanding of &lt;a href=&quot;https://realpython.com/remove-item-from-list-python/&quot;&gt;How to Remove Items From Lists in Python&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit the different approaches to removing items from a list in Python, including &lt;code&gt;.pop()&lt;/code&gt;, &lt;code&gt;.remove()&lt;/code&gt;, the &lt;code&gt;del&lt;/code&gt; statement, and more.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Programming Sockets in Python</title>
      <id>https://realpython.com/courses/programming-sockets/</id>
      <link href="https://realpython.com/courses/programming-sockets/"/>
      <updated>2024-12-17T14:00:00+00:00</updated>
      <summary>In this in-depth video course, you&#x27;ll learn how to build a socket server and client with Python. By the end, you&#x27;ll understand how to use the main functions and methods in Python&#x27;s socket module to write your own networked client-server applications.</summary>
      <content type="html">
        &lt;p&gt;Sockets and the socket API are used to send messages across a network. They provide a form of &lt;a href=&quot;https://en.wikipedia.org/wiki/Inter-process_communication&quot;&gt;inter-process communication (IPC)&lt;/a&gt;. The network can be a logical, local network to the computer, or one that&amp;rsquo;s physically connected to an external network with its own connections to other networks. The obvious example is the Internet, which you connect to via your ISP.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll create:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A simple &lt;strong&gt;socket server and client&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;An improved version that handles &lt;strong&gt;multiple connections&lt;/strong&gt; simultaneously&lt;/li&gt;
&lt;li&gt;A server-client application that functions like a full-fledged &lt;strong&gt;socket application&lt;/strong&gt;, complete with its own &lt;strong&gt;custom header and content&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Documenting Python Projects With Sphinx and Read the Docs</title>
      <id>https://realpython.com/courses/python-sphinx/</id>
      <link href="https://realpython.com/courses/python-sphinx/"/>
      <updated>2024-12-10T14:00:00+00:00</updated>
      <summary>In this video series, you&#x27;ll create project documentation from scratch using Sphinx, the de facto standard for Python. You&#x27;ll also hook your code repository up to Read The Docs to automatically build and publish your code documentation.</summary>
      <content type="html">
        &lt;p&gt;&lt;a href=&quot;https://www.sphinx-doc.org/&quot;&gt;Sphinx&lt;/a&gt; is a document generation tool that&amp;rsquo;s become the de facto standard for Python projects. It uses the &lt;a href=&quot;https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html&quot;&gt;reStructuredText&lt;/a&gt; (RST) markup language to define document structure and styling, and it can output in a wide variety of formats, including &lt;a href=&quot;https://realpython.com/html-css-python/&quot;&gt;HTML&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/EPUB&quot;&gt;ePub&lt;/a&gt;, &lt;a href=&quot;https://en.wikipedia.org/wiki/Man_page&quot;&gt;man pages&lt;/a&gt;, and much more. Sphinx is extendable and has plugins for incorporating &lt;a href=&quot;https://docs.python.org/3/library/pydoc.html&quot;&gt;pydoc&lt;/a&gt; comments from your code into your docs and for using &lt;a href=&quot;https://jupyterbook.org/en/stable/content/myst.html&quot;&gt;MyST Markdown&lt;/a&gt; instead of RST.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://readthedocs.org/&quot;&gt;Read the Docs&lt;/a&gt; is a free document hosting site where many Python projects host their documentation. It integrates with &lt;a href=&quot;https://realpython.com/python-git-github-intro/&quot;&gt;GitHub&lt;/a&gt;, &lt;a href=&quot;https://about.gitlab.com/&quot;&gt;GitLab&lt;/a&gt;, and &lt;a href=&quot;https://bitbucket.org/&quot;&gt;Bitbucket&lt;/a&gt; to automatically pull new documentation sources from your repositories and build their Sphinx sources.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Write your documentation with &lt;strong&gt;Sphinx&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Structure and style your document with &lt;strong&gt;RST syntax&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Incorporate your &lt;strong&gt;pydoc&lt;/strong&gt; comments into your documentation&lt;/li&gt;
&lt;li&gt;Host your documentation on &lt;strong&gt;Read the Docs&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;With these skills, you&amp;rsquo;ll be able to write clear, reliable documentation that&amp;rsquo;ll help your users get the most out of your project.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #231: Good Python Programming Practices When New to the Language</title>
      <id>https://realpython.com/podcasts/rpp/231/</id>
      <link href="https://realpython.com/podcasts/rpp/231/"/>
      <updated>2024-12-06T12:00:00+00:00</updated>
      <summary>What advice would you give to someone moving from another language to Python? What good programming practices are inherent to the language? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;What advice would you give to someone moving from another language to Python? What good programming practices are inherent to the language? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder&#x27;s Weekly articles and projects.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Handling or Preventing Errors in Python: LBYL vs EAFP</title>
      <id>https://realpython.com/courses/handling-preventing-errors-lbyl-eafp/</id>
      <link href="https://realpython.com/courses/handling-preventing-errors-lbyl-eafp/"/>
      <updated>2024-12-03T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn about two popular coding styles in Python: Look Before You Leap (LBYL) and Easier to Ask Forgiveness than Permission (EAFP). You can use these styles to deal with errors and exceptional situations in your code. You&#x27;ll dive into the discussion on LBYL vs EAFP in Python.</summary>
      <content type="html">
        &lt;p&gt;Dealing with errors and exceptional situations is a common requirement in programming. You can either &lt;em&gt;prevent errors&lt;/em&gt; before they happen or &lt;em&gt;handle errors&lt;/em&gt; after they&amp;rsquo;ve happened. In general, you&amp;rsquo;ll have two coding styles matching these strategies: &lt;strong&gt;look before you leap&lt;/strong&gt; (LBYL), and &lt;strong&gt;easier to ask forgiveness than permission&lt;/strong&gt; (EAFP). In this video course, you&amp;rsquo;ll dive into the questions and considerations surrounding LBYL vs EAFP in Python.&lt;/p&gt;
&lt;p&gt;By learning about Python&amp;rsquo;s LBYL and EAFP coding styles, you&amp;rsquo;ll be able to decide which strategy and coding style to use when you&amp;rsquo;re dealing with errors in your code.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use the &lt;strong&gt;LBYL&lt;/strong&gt; and &lt;strong&gt;EAFP&lt;/strong&gt; styles in your Python code&lt;/li&gt;
&lt;li&gt;Understand the &lt;strong&gt;pros&lt;/strong&gt; and &lt;strong&gt;cons&lt;/strong&gt; of LBYL vs EAFP&lt;/li&gt;
&lt;li&gt;Decide &lt;strong&gt;when to use&lt;/strong&gt; either LBYL or EAFP&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #230: marimo: Reactive Notebooks and Deployable Web Apps in Python</title>
      <id>https://realpython.com/podcasts/rpp/230/</id>
      <link href="https://realpython.com/podcasts/rpp/230/"/>
      <updated>2024-11-29T12:00:00+00:00</updated>
      <summary>What are common issues with using notebooks for Python development? How do you know the current state, share reproducible results, or create interactive applications? This week on the show, we speak with Akshay Agrawal about the open-source reactive marimo notebook for Python.</summary>
      <content type="html">
        &lt;p&gt;What are common issues with using notebooks for Python development? How do you know the current state, share reproducible results, or create interactive applications? This week on the show, we speak with Akshay Agrawal about the open-source reactive marimo notebook for Python.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Managing Dependencies With Python Poetry</title>
      <id>https://realpython.com/courses/managing-dependencies-with-poetry/</id>
      <link href="https://realpython.com/courses/managing-dependencies-with-poetry/"/>
      <updated>2024-11-26T14:00:00+00:00</updated>
      <summary>Learn how Python Poetry can help you start new projects, maintain existing ones, and master dependency management.</summary>
      <content type="html">
        &lt;p&gt;When your Python project relies on external packages, you need to make sure you&amp;rsquo;re using the right version of each package. After an update, a package might not work as it did before. A &lt;strong&gt;dependency manager&lt;/strong&gt; like Python Poetry helps you specify, install, and resolve external packages in your projects. This way, you can be sure that you always work with the correct dependency version on every machine.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create a &lt;strong&gt;new project&lt;/strong&gt; using Poetry&lt;/li&gt;
&lt;li&gt;Add Poetry to an &lt;strong&gt;existing project&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Configure your project through &lt;strong&gt;&lt;code&gt;pyproject.toml&lt;/code&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Pin your project&amp;rsquo;s &lt;strong&gt;dependency versions&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Install dependencies from a &lt;strong&gt;&lt;code&gt;poetry.lock&lt;/code&gt;&lt;/strong&gt; file&lt;/li&gt;
&lt;li&gt;Run basic Poetry commands using the &lt;strong&gt;Poetry CLI&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #229: The Joy of Tinkering &amp; Python Free-Threading Performance</title>
      <id>https://realpython.com/podcasts/rpp/229/</id>
      <link href="https://realpython.com/podcasts/rpp/229/"/>
      <updated>2024-11-22T12:00:00+00:00</updated>
      <summary>What keeps your spark alive for developing software and learning Python? Do you like to try new frameworks, build toy projects, or collaborate with other developers? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;What keeps your spark alive for developing software and learning Python? Do you like to try new frameworks, build toy projects, or collaborate with other developers? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder&#x27;s Weekly articles and projects.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: Expression vs Statement in Python: What&#x27;s the Difference?</title>
      <id>https://realpython.com/quizzes/python-expression-vs-statement/</id>
      <link href="https://realpython.com/quizzes/python-expression-vs-statement/"/>
      <updated>2024-11-21T12:00:00+00:00</updated>
      <summary>In this quiz, you&#x27;ll test your understanding of Python expressions vs statements. Knowing the difference between these two is crucial for writing efficient and readable Python code.</summary>
      <content type="html">
        &lt;p&gt;In this quiz, you&amp;rsquo;ll test your understanding of
&lt;a href=&quot;https://realpython.com/python-expression-vs-statement/&quot;&gt;Expression vs Statement in Python: What&amp;rsquo;s the Difference?&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit the key differences between expressions and statements in Python, and how to use them effectively in your code.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: Interacting With Python</title>
      <id>https://realpython.com/quizzes/interacting-with-python/</id>
      <link href="https://realpython.com/quizzes/interacting-with-python/"/>
      <updated>2024-11-21T12:00:00+00:00</updated>
      <summary>In this quiz, you&#x27;ll test your understanding of the different ways of interacting with Python. By working through this quiz, you&#x27;ll revisit key concepts related to Python interaction in interactive mode using the REPL, through Python script files, and within IDEs and code editors.</summary>
      <content type="html">
        &lt;p&gt;In this quiz, you&amp;rsquo;ll test your understanding of the different ways you can &lt;a href=&quot;https://realpython.com/interacting-with-python/&quot;&gt;interact with Python&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit key concepts related to Python interaction in interactive mode using the Read-Eval-Print Loop (REPL), through Python script files, and within Integrated Development Environments (IDEs) and code editors.&lt;/p&gt;
&lt;p&gt;You&amp;rsquo;ll also test your knowledge of some other options that may be useful, such as Jupyter Notebooks.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: NumPy Practical Examples: Useful Techniques</title>
      <id>https://realpython.com/quizzes/numpy-example/</id>
      <link href="https://realpython.com/quizzes/numpy-example/"/>
      <updated>2024-11-20T12:00:00+00:00</updated>
      <summary>This quiz will test your understanding of working with NumPy arrays. You won&#x27;t find all the answers in the tutorial, so you&#x27;ll need to do some extra investigating. By finding all the answers, you&#x27;re sure to learn some interesting things along the way.</summary>
      <content type="html">
        &lt;p&gt;In this quiz, you&amp;rsquo;ll test your understanding of the techniques covered in the tutorial
&lt;a href=&quot;https://realpython.com/numpy-example/&quot;&gt;NumPy Practical Examples: Useful Techniques&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through the questions, you&amp;rsquo;ll review your understanding of NumPy arrays and also expand on what you learned in the tutorial. &lt;/p&gt;
&lt;p&gt;You&amp;rsquo;ll need to do some research outside of the tutorial to answer all the questions. Embrace this challenge and let it take you on a learning journey.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Working With TOML and Python</title>
      <id>https://realpython.com/courses/working-with-toml-python/</id>
      <link href="https://realpython.com/courses/working-with-toml-python/"/>
      <updated>2024-11-19T14:00:00+00:00</updated>
      <summary>TOML is a configuration file format that&#x27;s becoming increasingly popular in the Python community. In this video course, you&#x27;ll learn the syntax of TOML and explore how you can work with TOML files in your own projects.</summary>
      <content type="html">
        &lt;p&gt;TOML&amp;mdash;Tom&amp;rsquo;s Obvious Minimal Language&amp;mdash;is a reasonably new configuration file format that the Python community has embraced over the last couple of years. TOML plays an essential part in the Python ecosystem. Many of your favorite tools rely on TOML for configuration, and you&amp;rsquo;ll use &lt;code&gt;pyproject.toml&lt;/code&gt; when you build and distribute your own packages.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn more about TOML and how you can use it. In particular, you&amp;rsquo;ll:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Learn and understand the &lt;strong&gt;syntax&lt;/strong&gt; of TOML&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;tomli&lt;/code&gt; and &lt;code&gt;tomllib&lt;/code&gt; to &lt;strong&gt;parse&lt;/strong&gt; TOML documents&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;tomli_w&lt;/code&gt; to &lt;strong&gt;write&lt;/strong&gt; data structures as TOML&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;tomlkit&lt;/code&gt; when you need &lt;strong&gt;more control&lt;/strong&gt; over your TOML files&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #228: Maintaining the Foundations of Python &amp; Cautionary Tales</title>
      <id>https://realpython.com/podcasts/rpp/228/</id>
      <link href="https://realpython.com/podcasts/rpp/228/"/>
      <updated>2024-11-15T12:00:00+00:00</updated>
      <summary>How do you build a sustainable open-source project and community? What lessons can be learned from Python&#x27;s history and the current mess that the WordPress community is going through? This week on the show, we speak with Paul Everitt from JetBrains about navigating open-source funding and the start of the Python Software Foundation.</summary>
      <content type="html">
        &lt;p&gt;How do you build a sustainable open-source project and community? What lessons can be learned from Python&#x27;s history and the current mess that the WordPress community is going through? This week on the show, we speak with Paul Everitt from JetBrains about navigating open-source funding and the start of the Python Software Foundation.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: Namespaces and Scope in Python</title>
      <id>https://realpython.com/quizzes/python-namespaces-scope/</id>
      <link href="https://realpython.com/quizzes/python-namespaces-scope/"/>
      <updated>2024-11-14T12:00:00+00:00</updated>
      <summary>In this quiz, you&#x27;ll test your understanding of Python namespaces and variable scope. These concepts are crucial for organizing the symbolic names assigned to objects in a Python program and ensuring they don&#x27;t interfere with one another.</summary>
      <content type="html">
        &lt;p&gt;In this quiz, you&amp;rsquo;ll test your understanding of
&lt;a href=&quot;https://realpython.com/python-namespaces-scope/&quot;&gt;Python Namespaces and Scope&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You&amp;rsquo;ll revisit how Python organizes symbolic names and objects in namespaces, when Python creates a new namespace, how namespaces are implemented, and how variable scope determines symbolic name visibility.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: Basic Input and Output in Python</title>
      <id>https://realpython.com/quizzes/python-input-output/</id>
      <link href="https://realpython.com/quizzes/python-input-output/"/>
      <updated>2024-11-13T12:00:00+00:00</updated>
      <summary>In this quiz, you&#x27;ll test your understanding of Python&#x27;s built-in functions for user interaction, namely input() and print(). These functions allow you to capture user input from the keyboard and display output to the console, respectively.</summary>
      <content type="html">
        &lt;p&gt;In this quiz, you&amp;rsquo;ll test your understanding of how to use Python&amp;rsquo;s built-in functions &lt;code&gt;input()&lt;/code&gt; and &lt;code&gt;print()&lt;/code&gt; for &lt;a href=&quot;https://realpython.com/python-input-output/&quot;&gt;basic input and output&lt;/a&gt; operations.&lt;/p&gt;
&lt;p&gt;You&amp;rsquo;ll also revisit how to use &lt;code&gt;readline&lt;/code&gt; to improve the user experience when collecting input, and how to format output using the &lt;code&gt;sep&lt;/code&gt; and &lt;code&gt;end&lt;/code&gt; keyword arguments of &lt;code&gt;print()&lt;/code&gt;.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: Python Dictionary Comprehensions: How and When to Use Them</title>
      <id>https://realpython.com/quizzes/python-dictionary-comprehension/</id>
      <link href="https://realpython.com/quizzes/python-dictionary-comprehension/"/>
      <updated>2024-11-13T12:00:00+00:00</updated>
      <summary>In this quiz, you&#x27;ll test your understanding of Python dictionary comprehensions. Dictionary comprehensions are a concise and quick way to create, transform, and filter dictionaries in Python, and can significantly enhance your code&#x27;s conciseness and readability.</summary>
      <content type="html">
        &lt;p&gt;In this quiz, you&amp;rsquo;ll test your understanding of &lt;a href=&quot;https://realpython.com/python-dictionary-comprehension/&quot;&gt;Python Dictionary Comprehensions: How and When to Use Them&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Understanding dictionary comprehensions is crucial for you as a Python developer because they provide a Pythonic tool for dictionary manipulation and can be a valuable addition to your programming toolkit.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Formatting Floats Inside Python F-Strings</title>
      <id>https://realpython.com/courses/format-floats-f-strings/</id>
      <link href="https://realpython.com/courses/format-floats-f-strings/"/>
      <updated>2024-11-12T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn how to use Python format specifiers within an f-string to allow you to neatly format a float to your required precision.</summary>
      <content type="html">
        &lt;p&gt;You&amp;rsquo;ll often need to format and round a Python &lt;a href=&quot;https://docs.python.org/3/library/functions.html#float&quot;&gt;&lt;code&gt;float&lt;/code&gt;&lt;/a&gt; to display the results of your calculations neatly within strings. In earlier versions of Python, this was a messy thing to do because you needed to round your numbers &lt;em&gt;first&lt;/em&gt; and then use either string concatenation or the &lt;a href=&quot;https://realpython.com/python-string-formatting/#1-old-style-string-formatting-operator&quot;&gt;old string formatting&lt;/a&gt; technique to do this for you. &lt;/p&gt;
&lt;p&gt;Since Python 3.6, the &lt;a href=&quot;https://peps.python.org/pep-0498/&quot;&gt;literal string interpolation&lt;/a&gt;, more commonly known as a &lt;strong&gt;formatted string literal&lt;/strong&gt; or &lt;strong&gt;&lt;a href=&quot;https://realpython.com/python-f-strings/&quot;&gt;f-string&lt;/a&gt;&lt;/strong&gt;, allows you to customize the content of your strings in a more readable way.&lt;/p&gt;
&lt;p&gt;An f-string is a literal string prefixed with a lowercase or uppercase letter &lt;code&gt;f&lt;/code&gt; and contains zero or more &lt;strong&gt;replacement fields&lt;/strong&gt; enclosed within a pair of curly braces &lt;code&gt;{...}&lt;/code&gt;. Each field contains an &lt;strong&gt;expression&lt;/strong&gt; that produces a value. You can calculate the field&amp;rsquo;s content, but you can also use function calls or even variables.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #227: New PEPs: Template Strings &amp; External Wheel Hosting</title>
      <id>https://realpython.com/podcasts/rpp/227/</id>
      <link href="https://realpython.com/podcasts/rpp/227/"/>
      <updated>2024-11-08T12:00:00+00:00</updated>
      <summary>Have you wanted the flexibility of f-strings but need safety checks in place? What if you could have deferred evaluation for logging or avoiding injection attacks? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;Have you wanted the flexibility of f-strings but need safety checks in place? What if you could have deferred evaluation for logging or avoiding injection attacks? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder&#x27;s Weekly articles and projects.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Introduction to Web Scraping With Python</title>
      <id>https://realpython.com/courses/introduction-to-web-scraping-with-python/</id>
      <link href="https://realpython.com/courses/introduction-to-web-scraping-with-python/"/>
      <updated>2024-11-05T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn all about web scraping in Python. You&#x27;ll see how to parse data from websites and interact with HTML forms using tools such as Beautiful Soup and MechanicalSoup.</summary>
      <content type="html">
        &lt;p&gt;&lt;strong&gt;Web scraping&lt;/strong&gt; is the process of collecting and parsing raw data from the Web, and the Python community has come up with some pretty powerful web scraping tools.&lt;/p&gt;
&lt;p&gt;The Internet hosts perhaps the greatest source of information on the planet. Many disciplines, such as &lt;a href=&quot;https://realpython.com/learning-paths/data-science-python-core-skills/&quot;&gt;data science&lt;/a&gt;, business intelligence, and investigative reporting, can benefit enormously from collecting and analyzing data from websites. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Parse website data using &lt;strong&gt;string methods&lt;/strong&gt; and &lt;strong&gt;regular expressions&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Parse website data using an &lt;strong&gt;HTML parser&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Interact with &lt;strong&gt;forms&lt;/strong&gt; and other website components&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: Variables in Python: Usage and Best Practices</title>
      <id>https://realpython.com/quizzes/python-variables/</id>
      <link href="https://realpython.com/quizzes/python-variables/"/>
      <updated>2024-11-05T12:00:00+00:00</updated>
      <summary>In this quiz, you&#x27;ll test your understanding of variables in Python. Variables are symbolic names that refer to objects or values stored in your computer&#x27;s memory, and they&#x27;re essential building blocks for any Python program.</summary>
      <content type="html">
        &lt;p&gt;In this quiz, you&amp;rsquo;ll test your understanding of &lt;a href=&quot;https://realpython.com/python-variables/&quot;&gt;Variables in Python: Usage and Best Practices&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit how to create and assign values to variables, change a variable&amp;rsquo;s data type dynamically, use variables to create expressions, counters, accumulators, and Boolean flags, follow best practices for naming variables, and create, access, and use variables in their scopes.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #226: PySheets: Spreadsheets in the Browser Using PyScript</title>
      <id>https://realpython.com/podcasts/rpp/226/</id>
      <link href="https://realpython.com/podcasts/rpp/226/"/>
      <updated>2024-11-01T12:00:00+00:00</updated>
      <summary>What goes into building a spreadsheet application in Python that runs in the browser? How do you make it launch quickly, and where do you store the cells of data? This week on the show, we speak with Chris Laffra about his project, PySheets, and his book &quot;Communication for Engineers.&quot;</summary>
      <content type="html">
        &lt;p&gt;What goes into building a spreadsheet application in Python that runs in the browser? How do you make it launch quickly, and where do you store the cells of data? This week on the show, we speak with Chris Laffra about his project, PySheets, and his book &quot;Communication for Engineers.&quot;&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Python&#x27;s Magic Methods in Classes</title>
      <id>https://realpython.com/courses/magic-methods-classes/</id>
      <link href="https://realpython.com/courses/magic-methods-classes/"/>
      <updated>2024-10-29T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn what magic methods are in Python, how they work, and how to use them in your custom classes to support powerful features in your object-oriented code.</summary>
      <content type="html">
        &lt;p&gt;As a Python developer who wants to harness the power of object-oriented programming, you&amp;rsquo;ll love to learn how to customize your classes using &lt;strong&gt;special methods&lt;/strong&gt;, also known as &lt;strong&gt;magic methods&lt;/strong&gt; or &lt;strong&gt;dunder methods&lt;/strong&gt;. A special method is a method whose name starts and ends with a double underscore. These methods have special meanings in Python.&lt;/p&gt;
&lt;p&gt;Python automatically calls magic methods as a response to certain operations, such as instantiation, sequence indexing, attribute managing, and much more. Magic methods support core object-oriented features in Python, so learning about them is fundamental for you as a Python programmer.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Learn what Python&amp;rsquo;s &lt;strong&gt;special&lt;/strong&gt; or &lt;strong&gt;magic methods&lt;/strong&gt; are&lt;/li&gt;
&lt;li&gt;Understand the &lt;strong&gt;magic&lt;/strong&gt; behind magic methods in Python&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Customize&lt;/strong&gt; different &lt;strong&gt;behaviors&lt;/strong&gt; of your custom classes with special methods&lt;/li&gt;
&lt;/ul&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: Using .__repr__() vs .__str__() in Python</title>
      <id>https://realpython.com/quizzes/python-repr-vs-str/</id>
      <link href="https://realpython.com/quizzes/python-repr-vs-str/"/>
      <updated>2024-10-29T12:00:00+00:00</updated>
      <summary>In this quiz, you&#x27;ll test your understanding of Python&#x27;s dunder repr and dunder str special methods. These methods allow you to control how a program displays an object, making your classes more readable and easier to debug and maintain.</summary>
      <content type="html">
        &lt;p&gt;In this quiz, you&amp;rsquo;ll test your understanding of &lt;a href=&quot;https://realpython.com/python-repr-vs-str/&quot;&gt;Python&amp;rsquo;s &lt;code&gt;.__repr__()&lt;/code&gt; and &lt;code&gt;.__str__()&lt;/code&gt;&lt;/a&gt; special methods. These methods allow you to control how a program displays an object, making your classes more readable and easier to debug and maintain.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>Quiz: Beautiful Soup: Build a Web Scraper With Python</title>
      <id>https://realpython.com/quizzes/beautiful-soup-web-scraper-python/</id>
      <link href="https://realpython.com/quizzes/beautiful-soup-web-scraper-python/"/>
      <updated>2024-10-28T12:00:00+00:00</updated>
      <summary>In this quiz, you&#x27;ll test your understanding of web scraping using Python. By working through this quiz, you&#x27;ll revisit how to inspect the HTML structure of a target site, decipher data encoded in URLs, and use Requests and Beautiful Soup for scraping and parsing data.</summary>
      <content type="html">
        &lt;p&gt;In this quiz, you&amp;rsquo;ll test your understanding of
&lt;a href=&quot;https://realpython.com/beautiful-soup-web-scraper-python/&quot;&gt;web scraping with Python, Requests, and Beautiful Soup&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;By working through this quiz, you&amp;rsquo;ll revisit how to inspect the HTML structure of your target site with your browser&amp;rsquo;s developer tools, decipher data encoded in URLs, use Requests and Beautiful Soup for scraping and parsing internet data, and gain an understanding of what a web scraping pipeline looks like.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #225: Python Getting Faster and Leaner &amp; Ideas for Django Projects</title>
      <id>https://realpython.com/podcasts/rpp/225/</id>
      <link href="https://realpython.com/podcasts/rpp/225/"/>
      <updated>2024-10-25T12:00:00+00:00</updated>
      <summary>What changes are happening under the hood in the latest versions of Python? How are these updates laying the groundwork for a faster Python in the coming years? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;What changes are happening under the hood in the latest versions of Python? How are these updates laying the groundwork for a faster Python in the coming years? Christopher Trudeau is back on the show this week, bringing another batch of PyCoder&#x27;s Weekly articles and projects.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  
    <entry>
      <title>The Real Python Podcast – Episode #224: Narwhals: Expanding DataFrame Compatibility Between Libraries</title>
      <id>https://realpython.com/podcasts/rpp/224/</id>
      <link href="https://realpython.com/podcasts/rpp/224/"/>
      <updated>2024-10-18T12:00:00+00:00</updated>
      <summary>How does a Python tool support all types of DataFrames and their various features? Could a lightweight library be used to add compatibility for newer formats like Polars or PyArrow? This week on the show, we speak with Marco Gorelli about his project, Narwhals.</summary>
      <content type="html">
        &lt;p&gt;How does a Python tool support all types of DataFrames and their various features? Could a lightweight library be used to add compatibility for newer formats like Polars or PyArrow? This week on the show, we speak with Marco Gorelli about his project, Narwhals.&lt;/p&gt;
        &lt;hr /&gt;
        &lt;p&gt;&lt;em&gt;[ Improve Your Python With 🐍 Python Tricks 💌 – Get a short &amp;amp; sweet Python Trick delivered to your inbox every couple of days. &lt;a href=&quot;https://realpython.com/python-tricks/?utm_source=realpython&amp;amp;utm_medium=rss&amp;amp;utm_campaign=footer&quot;&gt;&amp;gt;&amp;gt; Click here to learn more and see examples&lt;/a&gt; ]&lt;/em&gt;&lt;/p&gt;
      </content>
    </entry>
  

</feed>
