<?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>2023-09-12T14:00:00+00:00</updated>
  <id>https://realpython.com/</id>
  <author>
    <name>Real Python</name>
  </author>

  
    <entry>
      <title>Inheritance and Internals: Object-Oriented Programming in Python</title>
      <id>https://realpython.com/courses/python-class-inheritance/</id>
      <link href="https://realpython.com/courses/python-class-inheritance/"/>
      <updated>2023-09-12T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn about the various types of inheritance that you can use to write object-oriented code in Python. These include class inheritance, multilevel inheritance, and multiple inheritance, along with special methods and abstract base classes.</summary>
      <content type="html">
        &lt;p&gt;Python includes mechanisms for writing object-oriented code where the
data and operations on that data are structured together. The &lt;strong&gt;&lt;code&gt;class&lt;/code&gt; keyword&lt;/strong&gt;
is how you create these structures in Python. The definition of a class can be
based on other classes, allowing the creation of hierarchical structures and
promoting code reuse. This mechanism is known as inheritance.&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;Basic &lt;strong&gt;class inheritance&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Multi-level inheritance&lt;/strong&gt;, or classes that inherit from classes&lt;/li&gt;
&lt;li&gt;Classes that inherit directly from more than one class, or &lt;strong&gt;multiple inheritance&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Special methods&lt;/strong&gt; that you can use when writing classes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Abstract base classes&lt;/strong&gt; for classes that you don&amp;rsquo;t want to fully implement yet&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This course is the second in a three-part series. &lt;a href=&quot;https://realpython.com/courses/python-class-object/&quot;&gt;Part one&lt;/a&gt; is an introduction
to class syntax, teaching you how to write a class and use its attributes and
methods. Part three dives deeper into the philosophy behind writing good
object-oriented 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>Object-Oriented Programming (OOP) in Python 3</title>
      <id>https://realpython.com/python3-object-oriented-programming/</id>
      <link href="https://realpython.com/python3-object-oriented-programming/"/>
      <updated>2023-09-11T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn all about object-oriented programming (OOP) in Python. You&#x27;ll learn the basics of the OOP paradigm and cover concepts like classes and inheritance. You&#x27;ll also see to how instantiate an object from a class.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;&lt;strong&gt;Object-oriented programming (OOP)&lt;/strong&gt; is a method of structuring a program by bundling related properties and behaviors into individual &lt;strong&gt;objects&lt;/strong&gt;. In this tutorial, you’ll learn the basics of object-oriented programming in Python.&lt;/p&gt;
&lt;p&gt;Conceptually, objects are like the components of a system. Think of a program as a factory assembly line of sorts. At each step of the assembly line, a system component processes some material, ultimately transforming raw material into a finished product.&lt;/p&gt;
&lt;p&gt;An object contains data, like the raw or preprocessed materials at each step on an assembly line. In addition, the object contains behavior, like the action that each assembly line component performs.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Define a &lt;strong&gt;class&lt;/strong&gt;, which is like a blueprint for creating an object&lt;/li&gt;
&lt;li&gt;Use classes to &lt;strong&gt;create new objects&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Model systems with &lt;strong&gt;class inheritance&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&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 “Object-Oriented Programming (OOP)” 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. If you don’t use IDLE, you can &lt;a href=&quot;https://realpython.com/run-python-scripts/&quot;&gt;run the example code&lt;/a&gt; from the editor and environment 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;Get Your Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/object-oriented-programming-oop-in-python-3-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-object-oriented-programming-oop-in-python-3-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 do object-oriented programming with classes in Python 3.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;what-is-object-oriented-programming-in-python&quot;&gt;What Is Object-Oriented Programming in Python?&lt;a class=&quot;headerlink&quot; href=&quot;#what-is-object-oriented-programming-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Object-oriented programming is a &lt;a href=&quot;http://en.wikipedia.org/wiki/Programming_paradigm&quot;&gt;programming paradigm&lt;/a&gt; that provides a means of structuring programs so that properties and behaviors are bundled into individual &lt;strong&gt;objects&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;For example, an object could represent a person with &lt;strong&gt;properties&lt;/strong&gt; like a name, age, and address and &lt;strong&gt;behaviors&lt;/strong&gt; such as walking, talking, breathing, and running. Or it could represent an &lt;a href=&quot;https://realpython.com/python-send-email/&quot;&gt;email&lt;/a&gt; with properties like a recipient list, subject, and body and behaviors like adding attachments and sending. &lt;/p&gt;
&lt;p&gt;Put another way, object-oriented programming is an approach for modeling concrete, real-world things, like cars, as well as relations between things, like companies and employees or students and teachers. OOP models real-world entities as software objects that have some data associated with them and can perform certain operations.&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; You can also check out the &lt;a href=&quot;https://realpython.com/courses/python-basics-oop/&quot;&gt;Python Basics: Object-Oriented Programming&lt;/a&gt; video course to reinforce the skills that you’ll develop in this section of the tutorial.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The key takeaway is that objects are at the center of object-oriented programming in Python. In other programming paradigms, objects only represent the data. In OOP, they additionally inform the overall structure of the program.&lt;/p&gt;
&lt;h2 id=&quot;how-do-you-define-a-class-in-python&quot;&gt;How Do You Define a Class in Python?&lt;a class=&quot;headerlink&quot; href=&quot;#how-do-you-define-a-class-in-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In Python, you define a class by using the &lt;code&gt;class&lt;/code&gt; keyword followed by a name and a colon. Then you use &lt;code&gt;.__init__()&lt;/code&gt; to declare which attributes each instance of the class should have:&lt;/p&gt;
&lt;div class=&quot;highlight python&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;Employee&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;fm&quot;&gt;__init__&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
        &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;  &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;
        &lt;span class=&quot;bp&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;age&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;age&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;But what does all of that mean? And why do you even need classes in the first place? Take a step back and consider using built-in, primitive &lt;a href=&quot;https://realpython.com/courses/python-data-types/&quot;&gt;data structures&lt;/a&gt; as an alternative.&lt;/p&gt;
&lt;p&gt;Primitive data structures—like &lt;a href=&quot;https://realpython.com/python-numbers/&quot;&gt;numbers&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;strings&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-list/&quot;&gt;lists&lt;/a&gt;—are designed to represent straightforward pieces of information, such as the cost of an apple, the name of a poem, or your favorite colors, respectively. What if you want to represent something more complex?&lt;/p&gt;
&lt;p&gt;For example, you might want to track employees in an organization. You need to store some basic information about each employee, such as their name, age, position, and the year they started working.&lt;/p&gt;
&lt;p&gt;One way to do this is to represent each employee as a &lt;a href=&quot;https://realpython.com/python-list/&quot;&gt;list&lt;/a&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight python&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;kirk&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;James Kirk&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;34&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Captain&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2265&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;spock&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;Spock&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;35&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Science Officer&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2254&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;mccoy&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;Leonard McCoy&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Chief Medical Officer&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;2266&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;There are a number of issues with this approach.&lt;/p&gt;
&lt;p&gt;First, it can make larger code files more difficult to manage. If you reference &lt;code&gt;kirk[0]&lt;/code&gt; several lines away from where you declared the &lt;code&gt;kirk&lt;/code&gt; list, will you remember that the element with &lt;a href=&quot;https://realpython.com/python-strings/#string-indexing&quot;&gt;index&lt;/a&gt; &lt;code&gt;0&lt;/code&gt; is the employee’s name? &lt;/p&gt;
&lt;p&gt;Second, it can introduce errors if employees don’t have the same number of elements in their respective lists. In the &lt;code&gt;mccoy&lt;/code&gt; list above, the age is missing, so &lt;code&gt;mccoy[1]&lt;/code&gt; will return &lt;code&gt;&quot;Chief Medical Officer&quot;&lt;/code&gt; instead of &lt;a href=&quot;https://en.wikipedia.org/wiki/Leonard_McCoy&quot;&gt;Dr. McCoy’s&lt;/a&gt; age.&lt;/p&gt;
&lt;p&gt;A great way to make this type of code more manageable and more maintainable is to use &lt;strong&gt;classes&lt;/strong&gt;.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python3-object-oriented-programming/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python3-object-oriented-programming/ »&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 #171: Making Each Line of Code Efficient &amp; Python In Excel</title>
      <id>https://realpython.com/podcasts/rpp/171/</id>
      <link href="https://realpython.com/podcasts/rpp/171/"/>
      <updated>2023-09-08T12:00:00+00:00</updated>
      <summary>Are you writing efficient Python with as few lines of code as possible? Are you familiar with the many built-in language features that will simplify your code and make it more Pythonic? 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;Are you writing efficient Python with as few lines of code as possible? Are you familiar with the many built-in language features that will simplify your code and make it more Pythonic? 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>Generate Beautiful QR Codes With Python</title>
      <id>https://realpython.com/python-generate-qr-code/</id>
      <link href="https://realpython.com/python-generate-qr-code/"/>
      <updated>2023-09-06T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn how to use Python to generate QR codes, from your standard black-and-white QR codes to beautiful ones with your favorite colors. You&#x27;ll learn how to format QR codes, rotate them, and even replace the static background with moving images.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;From restaurant e-menus to airline boarding passes, &lt;strong&gt;QR codes&lt;/strong&gt; have numerous applications that impact your day-to-day life and enrich the user’s experience. Wouldn’t it be great to make them look good, too? With the help of this tutorial, you’ll learn how to use Python to generate beautiful QR codes for your personal use case. &lt;/p&gt;
&lt;p&gt;In its most basic format, a QR code contains black squares and dots on a white background, with information that any smartphone or device with a dedicated QR scanner can decode. Unlike a traditional bar code, which holds informationation horizontally, a QR code holds the data in two dimensions, and it can hold over a hundred times more information.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Generate&lt;/strong&gt; a basic black-and-white QR code&lt;/li&gt;
&lt;li&gt;Change the &lt;strong&gt;size&lt;/strong&gt; and &lt;strong&gt;margins&lt;/strong&gt; of the QR code&lt;/li&gt;
&lt;li&gt;Create &lt;strong&gt;colorful&lt;/strong&gt; QR codes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Rotate&lt;/strong&gt; the QR code&lt;/li&gt;
&lt;li&gt;Replace the static background with an &lt;strong&gt;animated GIF&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Traditionally, QR codes have been predominantly black-and-white. Now, thanks to creative innovations, QR codes come in all sorts of shapes, sizes, and colors. If you’d like to learn how to create not only two-tone QR codes but also colorful and artistic ones, then this is the tutorial for you.&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-generate-qr-code-bonus/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-generate-qr-code-bonus&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the sample code&lt;/a&gt; that shows you how to generate a beautiful code with Python.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;using-python-to-generate-a-basic-qr-code&quot;&gt;Using Python to Generate a Basic QR Code&lt;a class=&quot;headerlink&quot; href=&quot;#using-python-to-generate-a-basic-qr-code&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;To begin with, you’re going to create a black-and-white QR code that encodes some content. To follow along with this tutorial, you’ll need to install &lt;a href=&quot;https://segno.readthedocs.io/en/latest/&quot;&gt;Segno&lt;/a&gt;, which is a popular Python library for generating QR codes. To install Segno, you can run &lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/a&gt; from your &lt;a href=&quot;https://realpython.com/python-command-line-arguments/#the-command-line-interface&quot;&gt;command line&lt;/a&gt;: &lt;/p&gt;
&lt;div class=&quot;highlight sh&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;span class=&quot;w&quot;&gt; &lt;/span&gt;install&lt;span class=&quot;w&quot;&gt; &lt;/span&gt;segno
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Once you’ve installed &lt;code&gt;segno&lt;/code&gt;, create a Python file named &lt;code&gt;basic_qrcode.py&lt;/code&gt;. To create a black-and-white QR code object that encodes some content, you’ll have to use the &lt;code&gt;make_qr()&lt;/code&gt; function. This ensures that you’re creating a full-size QR code, and the only mandatory argument you’ll need to pass is the information that you want to encode. &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; You can also use the &lt;a href=&quot;https://segno.readthedocs.io/en/stable/api.html#segno.make&quot;&gt;&lt;code&gt;make()&lt;/code&gt;&lt;/a&gt; function to create a QR code object, but depending on the content you’re encoding, it might create a micro QR code. For the sake of this tutorial, you can think of that as a smaller QR code. To enforce the creation of a full-size QR code, you should use the &lt;code&gt;make_qr()&lt;/code&gt; function.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;QR codes are capable of handling all types of data, such as alphanumeric characters, symbols, and even URLs. To begin your journey of generating QR codes in Python, you’ll start by creating a QR code object that will encode the text &lt;code&gt;&quot;Hello, World&quot;&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;highlight python&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# basic_qrcode.py&lt;/span&gt;

&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;segno&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;segno&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;make_qr&lt;/span&gt;&lt;span class=&quot;p&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;p&gt;At this stage, you’ve written the code to encode the text &lt;code&gt;&quot;Hello, World&quot;&lt;/code&gt; by passing this to the &lt;code&gt;make_qr()&lt;/code&gt; function. This will greet your user with that text, and it might also offer the option of searching for &lt;code&gt;&quot;Hello, World&quot;&lt;/code&gt; on the Internet.&lt;/p&gt;
&lt;p&gt;Now, to generate a black-and-white QR code that you can actually view and scan, you’ll need to store the encoded content as a variable and use the &lt;a href=&quot;https://segno.readthedocs.io/en/stable/api.html#segno.QRCode.save&quot;&gt;&lt;code&gt;.save()&lt;/code&gt;&lt;/a&gt; method to save your QR code as an image. Here’s an example of how you can create a &lt;a href=&quot;https://realpython.com/python-variables/&quot;&gt;variable&lt;/a&gt; called &lt;code&gt;qrcode&lt;/code&gt; that encodes the text &lt;code&gt;&quot;Hello, World&quot;&lt;/code&gt; as a black-and-white QR code object, which you then save as a PNG file called &lt;code&gt;basic_qrcode.png&lt;/code&gt;: &lt;/p&gt;
&lt;div class=&quot;highlight python&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# basic_qrcode.py&lt;/span&gt;

&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;segno&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;qrcode&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;segno&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;make_qr&lt;/span&gt;&lt;span class=&quot;p&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;span class=&quot;hll&quot;&gt;&lt;span class=&quot;n&quot;&gt;qrcode&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;save&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;basic_qrcode.png&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The &lt;code&gt;.save()&lt;/code&gt; method serializes the QR code into a file format of your choice, as long as the chosen format is supported. When you apply &lt;code&gt;.save()&lt;/code&gt; to the variable that you’ve created with the encoded content, you need to specify the filename including an optional file path. In the example above, you’re saving the QR code image as a file named &lt;code&gt;basic_qrcode.png&lt;/code&gt; in the same directory where you’ll be executing your code, so you don’t specify a file path. &lt;/p&gt;
&lt;p&gt;If you’d like to save the image in a different directory, then you can specify the desired &lt;a href=&quot;https://realpython.com/python-pathlib/&quot;&gt;file path&lt;/a&gt; together with the filename as an argument in the &lt;code&gt;.save()&lt;/code&gt; method.&lt;/p&gt;
&lt;p&gt;Once you’ve finished writing the steps for generating a black-and-white QR code in &lt;code&gt;basic_qrcode.py&lt;/code&gt;, you’ll need to &lt;a href=&quot;https://realpython.com/run-python-scripts/&quot;&gt;run the Python script&lt;/a&gt; from your command line:&lt;/p&gt;
&lt;div class=&quot;highlight sh&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;basic_qrcode.py
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Congratulations, you’ve just created a black-and-white QR code that encodes the text &lt;code&gt;&quot;Hello, World&quot;&lt;/code&gt; using &lt;code&gt;make_qr()&lt;/code&gt; and &lt;code&gt;.save()&lt;/code&gt;. You can now scan your QR code image, which you’ll find in the same directory that you’re running your code from. Or, you can scan the QR code image below:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/my_first_qrcode.b078ef62bf2b.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/my_first_qrcode.b078ef62bf2b.png&quot; width=&quot;29&quot; height=&quot;29&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/my_first_qrcode.b078ef62bf2b.png&amp;amp;w=7&amp;amp;sig=103566dafee2d7f37ef8a26307e21a5fd7cdd840 7w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/my_first_qrcode.b078ef62bf2b.png&amp;amp;w=9&amp;amp;sig=79cd20a548f17a00a25bcc52abcbeca16bada377 9w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/my_first_qrcode.b078ef62bf2b.png&amp;amp;w=14&amp;amp;sig=508bd9e1858b7b4f28d4235399c18286a4433bfe 14w, https://files.realpython.com/media/my_first_qrcode.b078ef62bf2b.png 29w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;An image of a basic black and white QR Code&quot; data-asset=&quot;5206&quot;&gt;&lt;/a&gt;&lt;/figure&gt;

&lt;p&gt;You may have found that the QR code image is a little difficult to view or read because of its size, so the next item that you’re going to adjust is the size of your basic QR code.&lt;/p&gt;
&lt;h2 id=&quot;changing-the-size-the-qr-code&quot;&gt;Changing the Size the QR Code&lt;a class=&quot;headerlink&quot; href=&quot;#changing-the-size-the-qr-code&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;When trying to scan your QR code image or the QR code in the tutorial, you might have found it difficult to read because of its size.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-generate-qr-code/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-generate-qr-code/ »&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>Class Concepts: Object-Oriented Programming in Python</title>
      <id>https://realpython.com/courses/python-class-object/</id>
      <link href="https://realpython.com/courses/python-class-object/"/>
      <updated>2023-09-05T12:00:00+00:00</updated>
      <summary>Python uses object-oriented programming to group data and associated operations together into classes. In this video course, you&#x27;ll learn how to write object-oriented code with classes, attributes, and methods.</summary>
      <content type="html">
        &lt;p&gt;Python includes mechanisms for doing &lt;strong&gt;object-oriented programming&lt;/strong&gt;, where the
data and operations on that data are structured together. The &lt;code&gt;class&lt;/code&gt; keyword
is how you create these structures in Python. &lt;strong&gt;Attributes&lt;/strong&gt; are the data
values, and &lt;strong&gt;methods&lt;/strong&gt; are the function-like operations that you can perform 
on classes. In this course, you&amp;rsquo;ll explore writing code using &lt;code&gt;class&lt;/code&gt; and its 
associated attributes and methods.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this video course, you&amp;rsquo;ll learn about:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Why you write &lt;strong&gt;object-oriented code&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;How to write a &lt;strong&gt;class&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;What &lt;strong&gt;attributes&lt;/strong&gt; and &lt;strong&gt;methods&lt;/strong&gt; are&lt;/li&gt;
&lt;li&gt;How to use the &lt;strong&gt;descriptor protocol&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This course is the first in a three-part series. Part two covers how to
write reusable hierarchies of classes using inheritance, while part three
dives deeper into the philosophy behind writing good object-oriented code.&lt;/p&gt;
&lt;div class=&quot;container border rounded my-4&quot;&gt;
  &lt;div class=&quot;row my-3&quot;&gt;
    &lt;div class=&quot;col&quot;&gt;
      &lt;p class=&quot;small text-muted mb-0&quot;&gt;&lt;i class=&quot;fa fa-cloud-download mr-1&quot; aria-hidden=&quot;true&quot;&gt;&lt;/i&gt;
&lt;strong&gt;Download&lt;/strong&gt;&lt;/p&gt;
      &lt;a class=&quot;stretched-link&quot; href=&quot;/courses/python-class-object/downloads/python-class-object-code/&quot; target=&quot;_blank&quot;&gt;&lt;p class=&quot;h2 my-0 h3&quot;&gt;Sample Code (.zip)&lt;/p&gt;&lt;/a&gt;
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;5.2 KB&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;div class=&quot;container border rounded my-4&quot;&gt;
  &lt;div class=&quot;row my-3&quot;&gt;
    &lt;div class=&quot;col&quot;&gt;
      &lt;p class=&quot;small text-muted mb-0&quot;&gt;&lt;i class=&quot;fa fa-cloud-download mr-1&quot; aria-hidden=&quot;true&quot;&gt;&lt;/i&gt;
&lt;strong&gt;Download&lt;/strong&gt;&lt;/p&gt;
      &lt;a class=&quot;stretched-link&quot; href=&quot;/courses/python-class-object/downloads/python-class-object-slides/&quot; target=&quot;_blank&quot;&gt;&lt;p class=&quot;h2 my-0 h3&quot;&gt;Course Slides (.pdf)&lt;/p&gt;&lt;/a&gt;
      &lt;p class=&quot;text-muted mb-0 small&quot;&gt;1013.9 KB&lt;/p&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&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 News: What&#x27;s New From August 2023</title>
      <id>https://realpython.com/python-news-august-2023/</id>
      <link href="https://realpython.com/python-news-august-2023/"/>
      <updated>2023-09-04T14:00:00+00:00</updated>
      <summary>In August 2023, Python 3.12.0rc1 was released. Microsoft announced Python in Excel. The Python Software Foundation published its Annual Impact Report for 2023, and the Python ecosystem released new versions of several important projects, such as Django, Pydantic, and Flask.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;In August 2023, Python &lt;strong&gt;3.12.0rc1&lt;/strong&gt; came out! With several exciting features, improvements, and optimizations, this release is only two steps away from the final release scheduled for October. If you want to stay on the cutting edge, then you must give it a try. But note that you shouldn’t use it in production.&lt;/p&gt;
&lt;p&gt;Another exciting release was &lt;strong&gt;Python in Excel&lt;/strong&gt;, which allows you to leverage the power of Python inside your Excel workbooks. You’ll be able to use Python’s data science ecosystem while you remain in your Excel comfort zone with known formulas, charts, and more.&lt;/p&gt;
&lt;p&gt;But that’s not all! The &lt;strong&gt;Python Software Foundation (PSF)&lt;/strong&gt; announced a new roster of fellows and a safety and security engineer for PyPI. Some key package maintainers were busy with the &lt;strong&gt;Python DataFrame Summit 2023&lt;/strong&gt;, and several key libraries released new versions.&lt;/p&gt;
&lt;p&gt;Let’s dive into the most exciting &lt;strong&gt;Python news&lt;/strong&gt; from August 2023!&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;python-3120-release-candidate-arrives&quot;&gt;Python 3.12.0 Release Candidate Arrives&lt;a class=&quot;headerlink&quot; href=&quot;#python-3120-release-candidate-arrives&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;This August, Python put out its first &lt;strong&gt;release candidate&lt;/strong&gt; version, 3.12.0rc1. This version is only two steps away from the final release, 3.12.0, which is scheduled for October 2. Before that, Python will deliver another release candidate, planned for September 4.&lt;/p&gt;
&lt;p&gt;As Python ventures into the release candidate stage, only confirmed bug fixes will be accepted into the codebase. The goal is to have as few code changes as possible. Most likely, the core team will focus on:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Polishing and documenting all the changes&lt;/li&gt;
&lt;li&gt;Updating the &lt;a href=&quot;https://docs.python.org/3.12/whatsnew/3.12.html&quot;&gt;What’s New&lt;/a&gt; document&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As you can read in the release notes, 3.12 will have the following list of new features compared to Python 3.11:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.python.org/3.12/whatsnew/3.12.html#pep-701-syntactic-formalization-of-f-strings&quot;&gt;More flexible f-string parsing&lt;/a&gt;, allowing you to do more with your f-strings than you previously could (&lt;a href=&quot;https://peps.python.org/pep-0701/&quot;&gt;PEP 701&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.python.org/3.12/whatsnew/3.12.html#pep-688-making-the-buffer-protocol-accessible-in-python&quot;&gt;Support for the buffer protocol&lt;/a&gt; in Python code (&lt;a href=&quot;https://peps.python.org/pep-0688/&quot;&gt;PEP 688&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;A new debugging/profiling API (&lt;a href=&quot;https://peps.python.org/pep-0669/&quot;&gt;PEP 669&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.python.org/3.12/whatsnew/3.12.html#pep-684-a-per-interpreter-gil&quot;&gt;Support for isolated subinterpreters&lt;/a&gt; with separate global interpreter locks (&lt;a href=&quot;https://peps.python.org/pep-0684&quot;&gt;PEP 684&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.python.org/3.12/whatsnew/3.12.html#improved-error-messages&quot;&gt;Even more improved error messages&lt;/a&gt;, meaning that you get suggestions for more exceptions potentially caused by typos&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.python.org/3.12/howto/perf_profiling.html&quot;&gt;Support for the Linux &lt;code&gt;perf&lt;/code&gt; profiler&lt;/a&gt; to report Python function names in traces &lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://docs.python.org/3.12/whatsnew/3.12.html#optimizations&quot;&gt;Many large and small performance improvements&lt;/a&gt;, such as &lt;a href=&quot;https://peps.python.org/pep-0709/&quot;&gt;PEP 709&lt;/a&gt;, which deliver an estimated 5 percent overall performance improvement&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you’d like to learn more about some of these improvements, then check out Real Python’s previews of &lt;a href=&quot;https://realpython.com/python312-f-strings/&quot;&gt;more intuitive and consistent f-strings&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python312-error-messages/&quot;&gt;ever better error messages&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python312-perf-profiler/&quot;&gt;support for the Linux &lt;code&gt;perf&lt;/code&gt; profiler&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;As usual, this version also brings several deprecations that you may need to consider. For a detailed list of changes, additions, and removals, you can check the &lt;a href=&quot;https://docs.python.org/3.12/whatsnew/changelog.html#python-3-12-0-release-candidate-1&quot;&gt;changelog&lt;/a&gt; document.&lt;/p&gt;
&lt;p&gt;Just like other &lt;a href=&quot;https://realpython.com/python-pre-release/&quot;&gt;pre-release&lt;/a&gt; versions, Python 3.12.0rc1 is intended for experimentation and testing purposes only and isn’t recommended for use in production.&lt;/p&gt;
&lt;h2 id=&quot;python-makes-its-way-into-microsoft-excel&quot;&gt;Python Makes Its Way Into Microsoft Excel&lt;a class=&quot;headerlink&quot; href=&quot;#python-makes-its-way-into-microsoft-excel&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;On August 22, Microsoft announced &lt;a href=&quot;https://techcommunity.microsoft.com/t5/excel-blog/announcing-python-in-excel-combining-the-power-of-python-and-the/ba-p/3893439&quot;&gt;Python in Excel&lt;/a&gt;, a new and exciting feature that combines the flexibility of Excel and the power of Python. This combination may have a considerable impact on the &lt;a href=&quot;https://realpython.com/tutorials/data-science/&quot;&gt;data science&lt;/a&gt; industry.&lt;/p&gt;
&lt;p&gt;This is a huge announcement, and even &lt;a href=&quot;https://twitter.com/gvanrossum&quot;&gt;Guido van Rossum&lt;/a&gt; himself has been helping with the integration of both tools:&lt;/p&gt;
&lt;figure class=&quot;js-lightbox&quot;&gt;&lt;a href=&quot;https://files.realpython.com/media/guido-twitter-about-python-in-excel.d92b130cf754.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/guido-twitter-about-python-in-excel.d92b130cf754.png&quot; width=&quot;1186&quot; height=&quot;1066&quot; srcset=&quot;https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/guido-twitter-about-python-in-excel.d92b130cf754.png&amp;amp;w=296&amp;amp;sig=7bb19e05d0a66b43d0edd026e14e5f181d2f1c37 296w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/guido-twitter-about-python-in-excel.d92b130cf754.png&amp;amp;w=395&amp;amp;sig=8cb9d1ae09d3065ec77f10c92ed46e296bda3b1c 395w, https://robocrop.realpython.net/?url=https%3A//files.realpython.com/media/guido-twitter-about-python-in-excel.d92b130cf754.png&amp;amp;w=593&amp;amp;sig=3e3fc9df48b98e69c1d29268fdce1e7ba002f3b2 593w, https://files.realpython.com/media/guido-twitter-about-python-in-excel.d92b130cf754.png 1186w&quot; sizes=&quot;(min-width: 1200px) 690px, (min-width: 780px) calc(-5vw + 669px), (min-width: 580px) 510px, calc(100vw - 30px)&quot; alt=&quot;Guido Twitter&#x27;s Post About Python in Excel&quot; data-asset=&quot;5332&quot;&gt;&lt;/a&gt;&lt;figcaption class=&quot;figure-caption text-center&quot;&gt;&lt;a href=&quot;https://twitter.com/gvanrossum/status/1694031794306458056&quot; target=&quot;_blank&quot;&gt;Image source&lt;/a&gt;&lt;/figcaption&gt;&lt;/figure&gt;

&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=H4XbvL8Mglc&quot;&gt;Python in Excel&lt;/a&gt; allows you to natively use Python inside an Excel workbook without any additional setup requirements. You only need the new &lt;code&gt;PY&lt;/code&gt; function, which lets you input Python code directly into Excel cells:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-news-august-2023/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-news-august-2023/ »&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 #170: Finding the Right Coding Font for Programming in Python</title>
      <id>https://realpython.com/podcasts/rpp/170/</id>
      <link href="https://realpython.com/podcasts/rpp/170/"/>
      <updated>2023-09-01T12:00:00+00:00</updated>
      <summary>What should you consider when picking a font for coding in Python? What characters and their respective glyphs should you check before making your decision? This week on the show, we talk with Real Python author and core team member Philipp Acsany about his recent article, Choosing the Best Coding Font for Programming.</summary>
      <content type="html">
        &lt;p&gt;What should you consider when picking a font for coding in Python? What characters and their respective glyphs should you check before making your decision? This week on the show, we talk with Real Python author and core team member Philipp Acsany about his recent article, Choosing the Best Coding Font for Programming.&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: Build a Portfolio App</title>
      <id>https://realpython.com/get-started-with-django-1/</id>
      <link href="https://realpython.com/get-started-with-django-1/"/>
      <updated>2023-08-30T14:00:00+00:00</updated>
      <summary>In this step-by-step tutorial, you&#x27;ll learn the basics of creating powerful web applications with Django, a Python web framework. You&#x27;ll build an example portfolio application to showcase your web development projects.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Django is a fully featured Python web framework that you can use to build complex web applications. In this tutorial, you’ll jump in and learn &lt;a href=&quot;https://realpython.com/tutorials/django/&quot;&gt;Django&lt;/a&gt; by completing an example project. You’ll follow the steps to create a fully functioning web application and, along the way, learn what some of the most important features of the framework are and how they work together.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Learn about the &lt;strong&gt;advantages&lt;/strong&gt; of using &lt;strong&gt;Django&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Investigate the &lt;strong&gt;architecture&lt;/strong&gt; of a Django site&lt;/li&gt;
&lt;li&gt;Set up a new Django project with &lt;strong&gt;multiple apps&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Build &lt;strong&gt;models and views&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Create and connect &lt;strong&gt;Django templates&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Upload images&lt;/strong&gt; into your Django site&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;At the end of this tutorial, you’ll have a working portfolio website to showcase your projects. If you’re curious about how the final &lt;strong&gt;source code&lt;/strong&gt; looks, then you can click the link below:&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/get-started-with-django-1-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-get-started-with-django-1-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the Python source code&lt;/a&gt; for your Django portfolio project.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;learn-django&quot;&gt;Learn Django&lt;a class=&quot;headerlink&quot; href=&quot;#learn-django&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;There are endless web development frameworks out there, so why should you learn Django over any of the others? First of all, it’s written in Python, one of the most readable and beginner-friendly programming languages out there.&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 assumes an intermediate knowledge of the Python language. If you’re new to programming with Python, then check out the &lt;a href=&quot;https://realpython.com/learning-paths/python-basics/&quot;&gt;Python Basics learning path&lt;/a&gt; or the &lt;a href=&quot;https://realpython.com/products/real-python-course/&quot;&gt;introductory course&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The second reason you should learn Django is the scope of its features. When building a website, you don’t need to rely on any external libraries or packages if you choose Django. This means that you don’t need to learn how to use anything else, and the syntax is seamless because you’re using only one framework.&lt;/p&gt;
&lt;p&gt;There’s also the added benefit that Django is straightforward to update, since the core functionality is in one package. If you do find yourself needing to add extra features, there are several external libraries that you can use to enhance your site.&lt;/p&gt;
&lt;p&gt;One of the great things about the Django framework is its &lt;a href=&quot;https://www.djangoproject.com/&quot;&gt;in-depth documentation&lt;/a&gt;. It has detailed documentation on every aspect of Django and also has great examples and even a tutorial to get you started.&lt;/p&gt;
&lt;p&gt;There’s also a fantastic community of Django developers, so if you get stuck, there’s almost always a way forward by either checking the docs or &lt;a href=&quot;https://realpython.com/community/&quot;&gt;asking the community&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Django is a high-level web application framework with loads of features. It’s great for anyone new to web development due to its fantastic documentation, and it’s especially great if you’re also familiar with Python.&lt;/p&gt;
&lt;h2 id=&quot;understand-the-structure-of-a-django-website&quot;&gt;Understand the Structure of a Django Website&lt;a class=&quot;headerlink&quot; href=&quot;#understand-the-structure-of-a-django-website&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A Django website consists of a single &lt;strong&gt;project&lt;/strong&gt; that’s split into separate &lt;strong&gt;apps&lt;/strong&gt;. The idea is that each app handles a self-contained task that the site needs to perform. As an example, imagine an application like Instagram. There are several different tasks that it needs to perform:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;User management&lt;/strong&gt;: Logging in and out, registering, and so on&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The image feed&lt;/strong&gt;: Uploading, editing, and displaying images&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Private messaging&lt;/strong&gt;: Sending messages between users and providing notifications&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These are each separate pieces of functionality, so if this example were a Django site, then each piece of functionality would be a different Django app inside a single Django project.&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; A Django project contains at least one app. But even when there are more apps in the Django project, you commonly refer to a Django project as a &lt;strong&gt;web app&lt;/strong&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The Django project holds some configurations that apply to the project as a whole, such as project settings, URLs, shared templates and static files. Each application can have its own database, and it’ll have its own functions to control how it displays data to the user in HTML templates.&lt;/p&gt;
&lt;p&gt;Each application also has its own URLs as well as its own HTML templates and static files, such as &lt;a href=&quot;https://realpython.com/python-vs-javascript/&quot;&gt;JavaScript&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/html-css-python/#style-your-content-with-css&quot;&gt;CSS&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Django apps are structured so that there’s a separation of logic. It supports the &lt;a href=&quot;https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller&quot;&gt;model-view-controller pattern&lt;/a&gt;, which is the architecture for most web frameworks. The basic principle is that each application includes three separate files that handle the three main pieces of logic separately:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Model&lt;/strong&gt; defines the data structure. This is usually the database description and often the base layer to an application.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;View&lt;/strong&gt; displays some or all of the data to the user with &lt;a href=&quot;https://realpython.com/html-css-python/&quot;&gt;HTML and CSS&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Controller&lt;/strong&gt; handles how the database and the view interact.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you want to learn more about the MVC pattern, then check out &lt;a href=&quot;https://realpython.com/the-model-view-controller-mvc-paradigm-summarized-with-legos/&quot;&gt;Model-View-Controller (MVC) Explained – With Legos&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In Django, the architecture is slightly different. Although it’s based on the MVC pattern, Django handles the controller part itself. There’s no need to define how the database and views interact. It’s all done for you!&lt;/p&gt;
&lt;p&gt;The pattern Django utilizes is called the &lt;strong&gt;model-view-template (MVT)&lt;/strong&gt; pattern. All you need to do is add some URL configurations that the views map to, and Django handles the rest!&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/get-started-with-django-1/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/get-started-with-django-1/ »&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>Create a Python Wordle Clone With Rich</title>
      <id>https://realpython.com/courses/python-wordle-clone/</id>
      <link href="https://realpython.com/courses/python-wordle-clone/"/>
      <updated>2023-08-29T14:00:00+00:00</updated>
      <summary>In this step-by-step project, you&#x27;ll build your own Wordle clone with Python. Your game will run in the terminal, and you&#x27;ll use Rich to ensure your word-guessing app looks good. Learn how to build a command-line application from scratch and then challenge your friends to a wordly competition!</summary>
      <content type="html">
        &lt;p&gt;In this video course, you&amp;rsquo;ll build your own &lt;strong&gt;Wordle clone&lt;/strong&gt; for the terminal. Since Josh Wardle launched &lt;a href=&quot;https://en.wikipedia.org/wiki/Wordle&quot;&gt;Wordle&lt;/a&gt; in October 2021, millions of people have played it. While you can play the original game on the Web, you&amp;rsquo;ll create your version as a command-line application and then use the &lt;strong&gt;Rich library&lt;/strong&gt; to make it look good.&lt;/p&gt;
&lt;p&gt;As you follow along in this step-by-step project, you&amp;rsquo;ll practice how to set up a simple prototype game before iteratively developing it into a solid application.&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;Build out a command-line application from a &lt;strong&gt;prototype&lt;/strong&gt; to a &lt;strong&gt;polished game&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Read and &lt;strong&gt;validate user input&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use Rich&amp;rsquo;s console to create an &lt;strong&gt;attractive user interface&lt;/strong&gt; in the terminal&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Organize your code&lt;/strong&gt; into functions&lt;/li&gt;
&lt;li&gt;Provide your users with &lt;strong&gt;actionable feedback&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You&amp;rsquo;ll create &lt;strong&gt;Wyrdl&lt;/strong&gt;, your own Wordle clone in Python. This project is for anyone getting comfortable with Python who wants to build a terminal application from the ground up. Throughout the course, you&amp;rsquo;ll build your code step-by-step while focusing on having a game that you can play from the start.&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>How to Iterate Through a Dictionary in Python</title>
      <id>https://realpython.com/iterate-through-dictionary-python/</id>
      <link href="https://realpython.com/iterate-through-dictionary-python/"/>
      <updated>2023-08-28T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll take a deep dive into how to iterate through a dictionary in Python. Dictionaries are a fundamental data type in Python, and you can solve various programming problems by iterating through them.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;&lt;strong&gt;Dictionaries&lt;/strong&gt; are one of the most important and useful built-in &lt;a href=&quot;https://realpython.com/python-data-structures/&quot;&gt;data structures&lt;/a&gt; in Python. They’re everywhere and are a fundamental part of the language itself. In your code, you’ll use dictionaries to solve many programming problems that may require iterating through the dictionary at hand. In this tutorial, you’ll dive deep into how to iterate through a dictionary in Python.&lt;/p&gt;
&lt;p&gt;Solid knowledge of dictionary iteration will help you write better, more robust code. In your journey through dictionary iteration, you’ll write several examples that will help you grasp the different ways to traverse a dictionary by iterating over its keys, values, and items.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Get to know some of the &lt;strong&gt;main features&lt;/strong&gt; of dictionaries&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Iterate through&lt;/strong&gt; a dictionary in Python by using different &lt;strong&gt;techniques&lt;/strong&gt; and tools&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Transform&lt;/strong&gt; your dictionaries while iterating through them in Python&lt;/li&gt;
&lt;li&gt;Explore other &lt;strong&gt;tools&lt;/strong&gt; and &lt;strong&gt;techniques&lt;/strong&gt; that facilitate dictionary iteration&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get the most out of this tutorial, you should have a basic understanding of Python &lt;a href=&quot;https://realpython.com/python-dicts/&quot;&gt;dictionaries&lt;/a&gt;, know how to use Python &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;&lt;code&gt;for&lt;/code&gt;&lt;/a&gt; loops, and be familiar with &lt;a href=&quot;https://realpython.com/list-comprehension-python/&quot;&gt;comprehensions&lt;/a&gt;. Knowing other tools like the built-in &lt;a href=&quot;https://realpython.com/python-map-function/&quot;&gt;&lt;code&gt;map()&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-filter-function/&quot;&gt;&lt;code&gt;filter()&lt;/code&gt;&lt;/a&gt; functions and the &lt;a href=&quot;https://realpython.com/python-itertools/&quot;&gt;&lt;code&gt;itertools&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-collections-module/&quot;&gt;&lt;code&gt;collections&lt;/code&gt;&lt;/a&gt; modules is also a plus.&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/iterate-through-dictionary-python-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-iterate-through-dictionary-python-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the sample code&lt;/a&gt; that shows you how to iterate through a dictionary with Python.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&quot;alert alert-primary&quot; role=&quot;alert&quot;&gt;
&lt;p&gt;&lt;strong&gt;&lt;i class=&quot;fa fa-graduation-cap&quot; aria-hidden=&quot;true&quot;&gt;&lt;/i&gt; Take the Quiz:&lt;/strong&gt; Test your knowledge with our interactive “Python Dictionary Iteration” quiz. Upon completion you will receive a score so you can track your learning progress over time:&lt;/p&gt;&lt;p class=&quot;text-center my-2&quot;&gt;&lt;a class=&quot;btn btn-primary&quot; href=&quot;/quizzes/python-dictionary-iteration/&quot; target=&quot;_blank&quot;&gt;Take the Quiz »&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;getting-started-with-python-dictionaries&quot;&gt;Getting Started With Python Dictionaries&lt;a class=&quot;headerlink&quot; href=&quot;#getting-started-with-python-dictionaries&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Dictionaries are a cornerstone of Python. Many aspects of the language are built around dictionaries. &lt;a href=&quot;https://realpython.com/python-modules-packages/&quot;&gt;Modules&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-classes/&quot;&gt;classes&lt;/a&gt;, objects, &lt;a href=&quot;https://realpython.com/python-scope-legb-rule/#globals&quot;&gt;&lt;code&gt;globals()&lt;/code&gt;&lt;/a&gt;, and &lt;a href=&quot;https://realpython.com/python-scope-legb-rule/#locals&quot;&gt;&lt;code&gt;locals()&lt;/code&gt;&lt;/a&gt; are all examples of how dictionaries are deeply wired into Python’s implementation.&lt;/p&gt;
&lt;p&gt;Here’s how the Python &lt;a href=&quot;https://docs.python.org/3/index.html&quot;&gt;official documentation&lt;/a&gt; defines a dictionary:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;An associative array, where arbitrary keys are mapped to values. The keys can be any object with &lt;code&gt;__hash__()&lt;/code&gt; and &lt;code&gt;__eq__()&lt;/code&gt; methods. (&lt;a href=&quot;https://docs.python.org/3/glossary.html#term-dictionary&quot;&gt;Source&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;There are a couple of points to notice in this definition:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Dictionaries map &lt;strong&gt;keys&lt;/strong&gt; to &lt;strong&gt;values&lt;/strong&gt; and store them in an array or &lt;strong&gt;collection&lt;/strong&gt;. The key-value pairs are commonly known as &lt;strong&gt;items&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Dictionary keys must be of a &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-hashable&quot;&gt;hashable&lt;/a&gt; type, which means that they must have a hash value that never changes during the key’s lifetime.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Unlike &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-sequence&quot;&gt;sequences&lt;/a&gt;, which are &lt;a href=&quot;https://realpython.com/python-iterators-iterables/#getting-to-know-python-iterables&quot;&gt;iterables&lt;/a&gt; that support element access using integer indices, dictionaries are indexed by keys. This means that you can access the values stored in a dictionary using the associated key rather than an integer index.&lt;/p&gt;
&lt;p&gt;The keys in a dictionary are much like a &lt;a href=&quot;https://realpython.com/python-sets/&quot;&gt;&lt;code&gt;set&lt;/code&gt;&lt;/a&gt;, which is a collection of hashable and unique objects. Because the keys need to be hashable, you can’t use &lt;a href=&quot;https://docs.python.org/3/glossary.html#term-mutable&quot;&gt;mutable&lt;/a&gt; objects as dictionary keys.&lt;/p&gt;
&lt;p&gt;On the other hand, dictionary values can be of any Python type, whether they’re hashable or not. There are literally no restrictions for values. You can use anything as a value in a Python dictionary.&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; The concepts and topics that you’ll learn about in this section and throughout this tutorial refer to the &lt;a href=&quot;https://realpython.com/cpython-source-code-guide/&quot;&gt;CPython&lt;/a&gt; implementation of Python. Other implementations, such as &lt;a href=&quot;https://realpython.com/pypy-faster-python/&quot;&gt;PyPy&lt;/a&gt;, &lt;a href=&quot;http://ironpython.net/&quot;&gt;IronPython&lt;/a&gt;, and &lt;a href=&quot;http://www.jython.org/index.html&quot;&gt;Jython&lt;/a&gt;, could exhibit different dictionary behaviors and features that are beyond the scope of this tutorial.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Before Python 3.6, dictionaries were &lt;em&gt;unordered&lt;/em&gt; data structures. This means that the order of items typically wouldn’t match the insertion order:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&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;c1&quot;&gt;# Python 3.5&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;likes&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;color&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;blue&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;fruit&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;apple&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;pet&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;dog&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;likes&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;{&#x27;color&#x27;: &#x27;blue&#x27;, &#x27;pet&#x27;: &#x27;dog&#x27;, &#x27;fruit&#x27;: &#x27;apple&#x27;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Note how the order of items in the resulting dictionary doesn’t match the order in which you originally inserted the items.&lt;/p&gt;
&lt;p&gt;In Python 3.6 and greater, the keys and values of a dictionary retain the same order in which you insert them into the underlying dictionary. From 3.6 onward, dictionaries are compact &lt;em&gt;ordered&lt;/em&gt; data structures:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&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;c1&quot;&gt;# Python 3.6&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;likes&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;color&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;blue&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;fruit&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;apple&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;pet&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;dog&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;likes&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;{&#x27;color&#x27;: &#x27;blue&#x27;, &#x27;fruit&#x27;: &#x27;apple&#x27;, &#x27;pet&#x27;: &#x27;dog&#x27;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Keeping the items in order is a pretty useful feature. However, if you work with code that supports older Python versions, then you must not rely on this feature, because it can generate buggy behaviors. With newer versions, it’s completely safe to rely on the feature.&lt;/p&gt;
&lt;p&gt;Another important feature of dictionaries is that they’re &lt;a href=&quot;https://realpython.com/python-mutable-vs-immutable-types/#dictionaries&quot;&gt;mutable&lt;/a&gt; data types. This means that you can add, delete, and update their items &lt;a href=&quot;https://en.wikipedia.org/wiki/In-place_algorithm&quot;&gt;in place&lt;/a&gt; as needed. It’s worth noting that this mutability also means that you can’t use a dictionary as a key in another dictionary.&lt;/p&gt;
&lt;h2 id=&quot;understanding-how-to-iterate-through-a-dictionary-in-python&quot;&gt;Understanding How to Iterate Through a Dictionary in Python&lt;a class=&quot;headerlink&quot; href=&quot;#understanding-how-to-iterate-through-a-dictionary-in-python&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/iterate-through-dictionary-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/iterate-through-dictionary-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>The Real Python Podcast – Episode #169: Improving Classification Models With XGBoost</title>
      <id>https://realpython.com/podcasts/rpp/169/</id>
      <link href="https://realpython.com/podcasts/rpp/169/"/>
      <updated>2023-08-25T12:00:00+00:00</updated>
      <summary>How can you improve a classification model while avoiding overfitting? Once you have a model, what tools can you use to explain it to others? This week on the show, we talk with author and Python trainer Matt Harrison about his new book Effective XGBoost: Tuning, Understanding, and Deploying Classification Models.</summary>
      <content type="html">
        &lt;p&gt;How can you improve a classification model while avoiding overfitting? Once you have a model, what tools can you use to explain it to others? This week on the show, we talk with author and Python trainer Matt Harrison about his new book Effective XGBoost: Tuning, Understanding, and Deploying Classification Models.&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>Click and Python: Build Extensible and Composable CLI Apps</title>
      <id>https://realpython.com/python-click/</id>
      <link href="https://realpython.com/python-click/"/>
      <updated>2023-08-23T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn how to use the Click library to build robust, extensible, and user-friendly command-line interfaces (CLI) for your Python automation and tooling scripts.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;You can use the &lt;strong&gt;Click&lt;/strong&gt; library to quickly provide your Python automation and tooling scripts with an extensible, composable, and user-friendly &lt;a href=&quot;https://en.wikipedia.org/wiki/Command-line_interface&quot;&gt;command-line interface (CLI)&lt;/a&gt;. Whether you’re a developer, data scientist, DevOps engineer, or someone who often uses Python to automate repetitive tasks, you’ll very much appreciate Click and its unique features.&lt;/p&gt;
&lt;p&gt;In the Python ecosystem, you’ll find multiple libraries for creating CLIs, including &lt;a href=&quot;https://realpython.com/command-line-interfaces-python-argparse/&quot;&gt;&lt;code&gt;argparse&lt;/code&gt;&lt;/a&gt; from the &lt;a href=&quot;https://docs.python.org/3/library/index.html&quot;&gt;standard library&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/python-typer-cli/&quot;&gt;Typer&lt;/a&gt;, and a few others. However, Click offers a robust, mature, intuitive, and feature-rich solution.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create &lt;strong&gt;command-line interfaces&lt;/strong&gt; with &lt;strong&gt;Click&lt;/strong&gt; and Python&lt;/li&gt;
&lt;li&gt;Add &lt;strong&gt;arguments&lt;/strong&gt;, &lt;strong&gt;options&lt;/strong&gt;, and &lt;strong&gt;subcommands&lt;/strong&gt; to your CLI apps&lt;/li&gt;
&lt;li&gt;Enhance the &lt;strong&gt;usage&lt;/strong&gt; and &lt;strong&gt;help pages&lt;/strong&gt; of your CLI apps with Click&lt;/li&gt;
&lt;li&gt;Prepare a Click CLI app for &lt;strong&gt;installation&lt;/strong&gt;, &lt;strong&gt;use&lt;/strong&gt;, and &lt;strong&gt;distribution&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get the most out of this tutorial, you should have a good understanding of Python programming, including topics such as using &lt;a href=&quot;https://realpython.com/primer-on-python-decorators/&quot;&gt;decorators&lt;/a&gt;. It’ll also be helpful if you’re familiar with using your current operating system’s command line or &lt;a href=&quot;https://realpython.com/terminal-commands/&quot;&gt;terminal&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-click-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-click-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the sample code&lt;/a&gt; that you’ll use to build your CLI app with Click and Python.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;creating-command-line-interfaces-with-click-and-python&quot;&gt;Creating Command-Line Interfaces With Click and Python&lt;a class=&quot;headerlink&quot; href=&quot;#creating-command-line-interfaces-with-click-and-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The &lt;a href=&quot;https://click.palletsprojects.com/en/8.0.x/&quot;&gt;Click&lt;/a&gt; library enables you to quickly create robust, feature-rich, and extensible &lt;a href=&quot;https://realpython.com/python-command-line-arguments/#the-command-line-interface&quot;&gt;command-line interfaces (CLIs)&lt;/a&gt; for your scripts and tools. This library can significantly speed up your development process because it allows you to focus on the application’s logic and leave CLI creation and management to the library itself.&lt;/p&gt;
&lt;p&gt;Click is a great alternative to the &lt;a href=&quot;https://realpython.com/command-line-interfaces-python-argparse/&quot;&gt;&lt;code&gt;argparse&lt;/code&gt;&lt;/a&gt; module, which is the default CLI framework in the Python standard library. Next up, you’ll learn what sets it apart.&lt;/p&gt;
&lt;h3 id=&quot;why-use-click-for-cli-development&quot;&gt;Why Use Click for CLI Development&lt;a class=&quot;headerlink&quot; href=&quot;#why-use-click-for-cli-development&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Compared with &lt;code&gt;argparse&lt;/code&gt;, Click provides a more flexible and intuitive framework for creating CLI apps that are highly extensible. It allows you to gradually compose your apps without restrictions and with a minimal amount of code. This code will be readable even when your CLI grows and becomes more complex.&lt;/p&gt;
&lt;p&gt;Click’s &lt;a href=&quot;https://en.wikipedia.org/wiki/API&quot;&gt;application programming interface (API)&lt;/a&gt; is highly intuitive and consistent. The API takes advantage of Python &lt;a href=&quot;https://realpython.com/primer-on-python-decorators/&quot;&gt;decorators&lt;/a&gt;, allowing you to add &lt;a href=&quot;https://realpython.com/command-line-interfaces-python-argparse/#commands-arguments-options-parameters-and-subcommands&quot;&gt;arguments, options, and subcommands&lt;/a&gt; to your CLIs quickly.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;Functions&lt;/a&gt; are fundamental in Click-based CLIs. You have to write functions that you can then wrap with the appropriate decorators to create arguments, commands, and so on.&lt;/p&gt;
&lt;p&gt;Click has several desirable features that you can take advantage of. For example, Click apps:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Can be &lt;strong&gt;lazily composable&lt;/strong&gt; without restrictions&lt;/li&gt;
&lt;li&gt;Follow the &lt;a href=&quot;https://en.wikipedia.org/wiki/Unix-like&quot;&gt;Unix&lt;/a&gt; &lt;strong&gt;command-line conventions&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Support loading values from &lt;strong&gt;environment variables&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Support custom &lt;strong&gt;prompts&lt;/strong&gt; for input values&lt;/li&gt;
&lt;li&gt;Handle &lt;strong&gt;paths&lt;/strong&gt; and &lt;strong&gt;files&lt;/strong&gt; out of the box&lt;/li&gt;
&lt;li&gt;Allow arbitrary nesting of commands, also known as &lt;strong&gt;subcommands&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You’ll find that Click has many other cool features. For example, Click keeps information about all of your arguments, options, and commands. This way, it can generate usage and help pages for the CLI, which improves the user experience.&lt;/p&gt;
&lt;p&gt;When it comes to processing user input, Click has a strong understanding of data types. Because of this feature, the library generates consistent error messages when the user provides the wrong type of input.&lt;/p&gt;
&lt;p&gt;Now that you have a general understanding of Click’s most relevant features, it’s time to get your hands dirty and write your first Click app.&lt;/p&gt;
&lt;h3 id=&quot;how-to-install-and-set-up-click-your-first-cli-app&quot;&gt;How to Install and Set Up Click: Your First CLI App&lt;a class=&quot;headerlink&quot; href=&quot;#how-to-install-and-set-up-click-your-first-cli-app&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Unlike &lt;code&gt;argparse&lt;/code&gt;, Click doesn’t come in the Python standard library. This means that you need to install Click as a dependency of your CLI project to use the library. You can install Click from &lt;a href=&quot;https://pypi.org/&quot;&gt;PyPI&lt;/a&gt; using &lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/a&gt;. First, you should create a Python &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;virtual environment&lt;/a&gt; to work on. You can do all of that with the following platform-specific commands:&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;i class=&quot;fa fa-windows text-muted mr-1&quot; aria-hidden=&quot;true&quot;&gt;&lt;/i&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;i class=&quot;fa fa-linux text-muted mr-1&quot; aria-hidden=&quot;true&quot;&gt;&lt;/i&gt;&lt;i class=&quot;fa fa-apple text-muted mr-1&quot; aria-hidden=&quot;true&quot;&gt;&lt;/i&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;highlight doscon&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; python -m venv venv
&lt;span class=&quot;gp&quot;&gt;PS&amp;gt;&lt;/span&gt; venv\Scripts\activate
&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; python -m pip install click
&lt;/code&gt;&lt;/pre&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;highlight sh&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;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;click
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;With the first two commands, you create and activate a Python virtual environment called &lt;code&gt;venv&lt;/code&gt; in your working directory. Once the environment is active, you install Click using &lt;code&gt;pip&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Great! You’ve installed Click in a fresh virtual environment. Now go ahead and fire up your favorite &lt;a href=&quot;https://realpython.com/python-ides-code-editors-guide/&quot;&gt;code editor&lt;/a&gt;. Create a new &lt;code&gt;hello.py&lt;/code&gt; file and add the following content to it:&lt;/p&gt;
&lt;div class=&quot;highlight python&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# hello.py&lt;/span&gt;

&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;click&lt;/span&gt;

&lt;span class=&quot;nd&quot;&gt;@click&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;command&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;nd&quot;&gt;@click&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;version_option&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;0.1.0&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;prog_name&lt;/span&gt;&lt;span class=&quot;o&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;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;hello&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;():&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;click&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;echo&lt;/span&gt;&lt;span class=&quot;p&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;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;vm&quot;&gt;__name__&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;__main__&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;hello&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-click/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-click/ »&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>Replacing a String in Python</title>
      <id>https://realpython.com/courses/replace-string-python/</id>
      <link href="https://realpython.com/courses/replace-string-python/"/>
      <updated>2023-08-22T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn how to remove or replace a string or substring. You&#x27;ll go from the basic string method .replace() all the way up to a multi-layer regex pattern using the sub() function from Python&#x27;s re module.</summary>
      <content type="html">
        &lt;p&gt;If you&amp;rsquo;re looking for ways to remove or replace all or part of a &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;string&lt;/a&gt; in Python, then this course is for you. You&amp;rsquo;ll be taking a fictional chat room transcript and &lt;a href=&quot;https://en.wikipedia.org/wiki/Sanitization_(classified_information)&quot;&gt;sanitizing&lt;/a&gt; it using both the &lt;strong&gt;&lt;code&gt;.replace()&lt;/code&gt; method&lt;/strong&gt; and the &lt;strong&gt;&lt;code&gt;re.sub()&lt;/code&gt; function&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;In Python, the &lt;code&gt;.replace()&lt;/code&gt; method and the &lt;code&gt;re.sub()&lt;/code&gt; function are often used to clean up text by removing strings or substrings or replacing them. In this tutorial, you&amp;rsquo;ll be playing the role of a developer for a company that provides technical support through a one-to-one text chat. You&amp;rsquo;re tasked with creating a script that&amp;rsquo;ll sanitize the chat, removing any &lt;a href=&quot;https://en.wikipedia.org/wiki/Personal_data&quot;&gt;personal data&lt;/a&gt; and replacing any swear words with emoji.&lt;/p&gt;
&lt;p&gt;You&amp;rsquo;re only given one very short chat transcript:&lt;/p&gt;
&lt;div class=&quot;highlight text&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;[support_tom] 2022-08-24T10:02:23+00:00 : What can I help you with?
[johndoe] 2022-08-24T10:03:15+00:00 : I CAN&amp;#39;T CONNECT TO MY BLASTED ACCOUNT
[support_tom] 2022-08-24T10:03:30+00:00 : Are you sure it&amp;#39;s not your caps lock?
[johndoe] 2022-08-24T10:04:03+00:00 : Blast! You&amp;#39;re right!
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Even though this transcript is short, it&amp;rsquo;s typical of the type of chats that agents have all the time. It has user identifiers, &lt;a href=&quot;https://en.wikipedia.org/wiki/ISO_8601&quot;&gt;ISO time stamps&lt;/a&gt;, and messages.&lt;/p&gt;
&lt;p&gt;In this case, the client &lt;code&gt;johndoe&lt;/code&gt; filed a complaint, and company policy is to sanitize and simplify the transcript, then pass it on for independent evaluation. Sanitizing the message is your job, and that&amp;rsquo;s what you&amp;rsquo;ll tackle in this video course.&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>Build a Code Image Generator With Python</title>
      <id>https://realpython.com/python-code-image-generator/</id>
      <link href="https://realpython.com/python-code-image-generator/"/>
      <updated>2023-08-21T14:00:00+00:00</updated>
      <summary>In this step-by-step tutorial, you&#x27;ll build a code image generator that creates nice-looking images of your code snippets to share on social media. Your code image generator will be powered by the Flask web framework and include exciting packages like Pygments and Playwright.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;If you’re active on social media, then you know that images and videos are popular forms of content. As a programmer, you mainly work with text, so sharing the content that you create on a daily basis may not seem intuitive. That’s where a code image generator can come in handy for you!&lt;/p&gt;
&lt;p&gt;With a code image generator, you can create a nice-looking image of your code snippets. That way, you can share code without worrying about formatting, different syntax highlighting, or character count limitations.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this step-by-step tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Set up and run a &lt;strong&gt;Flask project&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Connect and style &lt;strong&gt;Jinja templates&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;Playwright&lt;/strong&gt; to create images&lt;/li&gt;
&lt;li&gt;Beautify code with &lt;strong&gt;Pygments&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Leverage &lt;strong&gt;sessions&lt;/strong&gt; to save browser states&lt;/li&gt;
&lt;li&gt;Enhance the user experience with &lt;strong&gt;JavaScript&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Creating your own code image generator will allow you to hone your skills as a Python programmer and experiment with full-stack web development.&lt;/p&gt;
&lt;p&gt;Although you’ll find plenty of full-featured code image generators like &lt;a href=&quot;https://carbon.now.sh/&quot;&gt;carbon&lt;/a&gt; or &lt;a href=&quot;https://ray.so/&quot;&gt;ray.so&lt;/a&gt;, crafting a custom tool will allow you to meet your specific needs and continue to improve it later on.&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-code-image-generator-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-code-image-generator-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free source code&lt;/a&gt; for your Python code image generator.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;demo-a-code-image-generator-with-python&quot;&gt;Demo: A Code Image Generator With Python&lt;a class=&quot;headerlink&quot; href=&quot;#demo-a-code-image-generator-with-python&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The code image generator is a Flask project that creates stylish screenshots of a code snippet with the help of Pygments and Playwright. The project will run locally in your browser, and you have full control over the look of the code that you want to share:&lt;/p&gt;
&lt;figure&gt;
  &lt;div class=&quot;embed-responsive embed-responsive-16by9 rounded mb-3 border&quot;&gt;
    &lt;iframe loading=&quot;lazy&quot; class=&quot;embed-responsive-item&quot; src=&quot;https://player.vimeo.com/video/852591673?background=1&quot; frameborder=&quot;0&quot; allow=&quot;fullscreen&quot; allowfullscreen&gt;&lt;/iframe&gt;
  &lt;/div&gt;

&lt;/figure&gt;

&lt;p&gt;Once you run the Flask server, you can visit the application in the browser, add your own Python code, select a style, and download an image of the code to your computer.&lt;/p&gt;
&lt;h2 id=&quot;project-overview&quot;&gt;Project Overview&lt;a class=&quot;headerlink&quot; href=&quot;#project-overview&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You’ll build the code image generator in multiple steps. In each step, you’ll focus on one important area of your codebase.&lt;/p&gt;
&lt;p&gt;After setting up the project, you’ll notice that the structure of the tutorial mirrors the route that a user would take when using your tool. You start by creating the pages and functions to accept code input from the user.&lt;/p&gt;
&lt;p&gt;Then, you move on to implementing the selection of syntax highlighting styles. This will make a user’s code snippet look good when you build the route to generate an image of the code in the following step.&lt;/p&gt;
&lt;p&gt;Finally, you’ll have a closer look at some areas of your project and improve the user experience. At the end of the tutorial, you’ll have your very own code image generator that’s ready to use and highly extensible. &lt;/p&gt;
&lt;p&gt;Over the course of the tutorial, you’ll get guidance on which files and folders to create. In the end, your project layout will look like this:&lt;/p&gt;
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;code-image-generator/
│
├── static/
│   └── styles.css
│
├── templates/
│   ├── base.html
│   ├── code_input.html
│   ├── image.html
│   └── style_selection.html
│
├── app.py
└── utils.py
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;In the materials for this tutorial, you’ll find a folder for each step, containing source code of the project in its current state:&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-code-image-generator-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-code-image-generator-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free source code&lt;/a&gt; for your Python code image generator.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;At the end of each step, you can compare your own code with the source code while following along. If you have questions about a step or you’re stuck at some point, then you can scroll down to the comments area and ask the Real Python community for help.&lt;/p&gt;
&lt;h2 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;a class=&quot;headerlink&quot; href=&quot;#prerequisites&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In this tutorial, you’ll build a code image generator with Python, Flask, Pygments, and Playwright. While working through the steps, it’ll be helpful if you’re comfortable with the following concepts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/primer-on-jinja-templating/&quot;&gt;Jinja templating&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/html-css-python/&quot;&gt;HTML and CSS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/python-vs-javascript/&quot;&gt;JavaScript&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://realpython.com/primer-on-python-decorators/&quot;&gt;Python decorators&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you’re not confident in your knowledge of these prerequisites, then that’s okay too! In fact, going through this tutorial will help you learn and practice these concepts. You can always stop and review the resources linked above if you get stuck.&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-code-image-generator/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-code-image-generator/ »&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>Python Polars: A Lightning-Fast DataFrame Library</title>
      <id>https://realpython.com/polars-python/</id>
      <link href="https://realpython.com/polars-python/"/>
      <updated>2023-08-16T14:00:00+00:00</updated>
      <summary>Welcome to the world of Polars, a powerful DataFrame library for Python! In this showcase tutorial, you&#x27;ll get a hands-on introduction to Polars&#x27; core features and see why this library is catching so much buzz.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;In the world of data analysis and manipulation, Python has long been the go-to language. With extensive and user-friendly libraries like &lt;a href=&quot;https://realpython.com/numpy-tutorial/&quot;&gt;NumPy&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/learning-paths/pandas-data-science/&quot;&gt;pandas&lt;/a&gt;, &lt;a href=&quot;https://realpython.com/pyspark-intro/&quot;&gt;PySpark&lt;/a&gt;, and &lt;a href=&quot;https://tutorial.dask.org/00_overview.html&quot;&gt;Dask&lt;/a&gt;, there’s a solution available for almost any data-driven task. Among these libraries, one name that’s been generating a significant amount of buzz lately is &lt;a href=&quot;https://pola-rs.github.io/polars-book/&quot;&gt;Polars&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Polars is a high-performance DataFrame library, designed to provide fast and efficient data processing capabilities. Inspired by the reigning pandas library, Polars takes things to another level, offering a seamless experience for working with large datasets that might not fit into memory.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Why Polars is so &lt;strong&gt;performant&lt;/strong&gt; and attention-grabbing&lt;/li&gt;
&lt;li&gt;How to work with &lt;strong&gt;DataFrames&lt;/strong&gt;, &lt;strong&gt;expressions&lt;/strong&gt;, and &lt;strong&gt;contexts&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;What the &lt;strong&gt;lazy API&lt;/strong&gt; is and how to use it&lt;/li&gt;
&lt;li&gt;How to integrate Polars with &lt;strong&gt;external data sources&lt;/strong&gt; and the broader Python ecosystem&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;After reading, you’ll be equipped with the knowledge and resources necessary to get started using Polars for your own data tasks. Before reading, you’ll benefit from having a basic knowledge of Python and experience working with tabular datasets.
You should also be comfortable with DataFrames from any of the popular DataFrame libraries.&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/polars-python-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-polars-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 shows you how to optimize your data processing with the Python Polars library.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;the-python-polars-library&quot;&gt;The Python Polars Library&lt;a class=&quot;headerlink&quot; href=&quot;#the-python-polars-library&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Polars has caught a lot of attention in a short amount of time, and for good reason. In this first section, you’ll get an overview of Polars and a preview of the library’s powerful features. You’ll also learn how to install Polars along with any dependencies that you might need for your data processing task.&lt;/p&gt;
&lt;h3 id=&quot;getting-to-know-polars&quot;&gt;Getting to Know Polars&lt;a class=&quot;headerlink&quot; href=&quot;#getting-to-know-polars&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Polars combines the flexibility and user-friendliness of Python with the speed and scalability of &lt;a href=&quot;https://www.rust-lang.org/&quot;&gt;Rust&lt;/a&gt;, making it a compelling choice for a wide range of data processing tasks. So, what makes Polars stand out among the crowd? There are many reasons, one of the most prominent being that Polars is lightning fast.&lt;/p&gt;
&lt;p&gt;The core of Polars is written in Rust, a language that operates at a low level with no external dependencies. Rust is memory-efficient and gives you performance on par with &lt;a href=&quot;https://realpython.com/c-for-python-programmers/&quot;&gt;C&lt;/a&gt; or &lt;a href=&quot;https://realpython.com/python-vs-cpp/&quot;&gt;C++&lt;/a&gt;, making it a great language to underpin a data analysis library. Polars also ensures that you can utilize all available CPU cores in parallel, and it supports large datasets without requiring all data to be in memory.&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; If you want to take a deeper dive into Polars’ features, check out &lt;a href=&quot;https://realpython.com/podcasts/rpp/140/&quot;&gt;this Real Python Podcast episode&lt;/a&gt; with Liam Brannigan. Liam is a Polars contributor, and he offers a nice firsthand perspective on Polars’ capabilities.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Another standout feature of Polars is its intuitive API. If you’re already familiar with libraries like pandas, then you’ll feel right at home with Polars. The library provides a familiar yet unique interface, making it easy to transition to Polars. This means you can leverage your existing knowledge and codebase while taking advantage of Polars’ performance gains.&lt;/p&gt;
&lt;p&gt;Polars’ query engine leverages &lt;a href=&quot;https://arrow.apache.org/&quot;&gt;Apache Arrow&lt;/a&gt; to execute &lt;a href=&quot;https://www.sciencedirect.com/topics/computer-science/vectorization&quot;&gt;vectorized&lt;/a&gt; queries. Exploiting the power of &lt;a href=&quot;https://en.wikipedia.org/wiki/Column-oriented_DBMS&quot;&gt;columnar&lt;/a&gt; data storage, Apache Arrow is a development platform designed for fast in-memory processing. This is yet another rich feature that gives Polars an outstanding performance boost.&lt;/p&gt;
&lt;p&gt;These are just a few key details that make Polars an attractive data processing library, and you’ll get to see these in action throughout this tutorial. Up next, you’ll get an overview of how to install Polars.&lt;/p&gt;
&lt;h3 id=&quot;installing-python-polars&quot;&gt;Installing Python Polars&lt;a class=&quot;headerlink&quot; href=&quot;#installing-python-polars&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Before installing Polars, make sure you have Python and &lt;code&gt;pip&lt;/code&gt; installed on your system. Polars supports Python versions 3.7 and above. To check your Python version, open a terminal or command prompt and run the following command:&lt;/p&gt;
&lt;div class=&quot;highlight sh&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;--version
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If you have Python installed, then you’ll see the version number displayed below the command. If you don’t have Python 3.7 or above installed, follow &lt;a href=&quot;https://realpython.com/installing-python/&quot;&gt;these&lt;/a&gt; instructions to get the correct version.&lt;/p&gt;
&lt;p&gt;Polars is available on &lt;a href=&quot;https://pypi.org/&quot;&gt;PyPI&lt;/a&gt;, and you can install it with &lt;a href=&quot;https://realpython.com/what-is-pip/&quot;&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/a&gt;. Open a terminal or command prompt, create a new &lt;a href=&quot;https://realpython.com/python-virtual-environments-a-primer/&quot;&gt;virtual environment&lt;/a&gt;, and then run the following command to install Polars:&lt;/p&gt;
&lt;div class=&quot;highlight sh&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;polars
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This command will install the latest version of Polars from PyPI onto your machine. To verify that the installation was successful, start a &lt;a href=&quot;https://realpython.com/python-repl/&quot;&gt;Python REPL&lt;/a&gt; and import Polars:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&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;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;polars&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;pl&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;If the import runs without error, then you’ve successfully installed Polars. You now have the core of Polars installed on your system. This is a lightweight installation of Polars that allows you to get started without extra dependencies.&lt;/p&gt;
&lt;p&gt;Polars has other rich features that allow you to interact with the broader Python ecosystem and external data sources. To use these features, you need to install Polars with the &lt;a href=&quot;https://pola-rs.github.io/polars-book/user-guide/installation/#importing:~:text=polars%20as%20pl-,Feature%20Flags,-By%20using%20the&quot;&gt;feature flags&lt;/a&gt; that you’re interested in. For example, if you want to convert Polars DataFrames to pandas DataFrames and NumPy arrays, then run the following command when installing Polars:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/polars-python/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/polars-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>Process Images Using the Pillow Library and Python</title>
      <id>https://realpython.com/courses/python-pillow/</id>
      <link href="https://realpython.com/courses/python-pillow/"/>
      <updated>2023-08-15T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn how to use the Python Pillow library to deal with images and perform image processing. You&#x27;ll also explore using NumPy for further processing, including to create animations.</summary>
      <content type="html">
        &lt;p&gt;When you look at an image, you see the objects and people in it. However, when you read an image programmatically with Python or any other language, the computer sees an array of numbers. In this video course, you&amp;rsquo;ll learn how to manipulate images and perform basic image processing using the Python Pillow library.&lt;/p&gt;
&lt;p&gt;Pillow and its predecessor, PIL, are the original Python libraries for dealing with images. Even though there are other Python libraries for image processing, Pillow remains an important tool for understanding and dealing with images.&lt;/p&gt;
&lt;p&gt;To manipulate and process images, Pillow provides tools that are similar to ones found in image processing software such as Photoshop. Some of the more modern Python image processing libraries are built on top of Pillow and often provide more advanced functionality.&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;&lt;strong&gt;Read images&lt;/strong&gt; with Pillow&lt;/li&gt;
&lt;li&gt;Perform &lt;strong&gt;basic image manipulation&lt;/strong&gt; operations&lt;/li&gt;
&lt;li&gt;Use Pillow for &lt;strong&gt;image processing&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;NumPy&lt;/strong&gt; with Pillow for &lt;strong&gt;further processing&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Create animations&lt;/strong&gt; using Pillow&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In this video course, you&amp;rsquo;ll get an overview of what you can achieve with the Python Pillow library through some of its most common methods. Once you gain confidence using these methods, then you can use Pillow&amp;rsquo;s &lt;a href=&quot;https://pillow.readthedocs.io/en/stable/reference/index.html&quot;&gt;documentation&lt;/a&gt; to explore the rest of the methods in the library. If you&amp;rsquo;ve never worked with images in Python before, this is a great opportunity to jump right in!&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>What Are Python Asterisk and Slash Special Parameters For?</title>
      <id>https://realpython.com/python-asterisk-and-slash-special-parameters/</id>
      <link href="https://realpython.com/python-asterisk-and-slash-special-parameters/"/>
      <updated>2023-08-14T14:00:00+00:00</updated>
      <summary>In this tutorial, you&#x27;ll learn how to use the Python asterisk and slash special parameters in function definitions. With these symbols, you can define whether your functions will accept positional or keyword arguments.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;Whenever you think of Python’s asterisk operator (&lt;code&gt;*&lt;/code&gt;), you most likely think of multiplication or exponentiation.  Similarly, you probably associate the forward slash operator (&lt;code&gt;/&lt;/code&gt;) with division. But you can also use the bare asterisk and slash as &lt;strong&gt;special parameters&lt;/strong&gt; in function headers. These do something completely unrelated to mathematics.&lt;/p&gt;
&lt;p&gt;When &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/&quot;&gt;defining functions&lt;/a&gt;, you’ll often include a list of comma-separated parameters to define what types of arguments the user can pass to your function. Using the asterisk and forward slash symbols as special parameters in your function header may look strange at first:&lt;/p&gt;
&lt;div class=&quot;highlight python&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;strange_function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&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;n&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;another_strange_function&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;n&quot;&gt;c&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;n&quot;&gt;d&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;Both of these function definitions may look a bit odd, but their function parameters are actually perfectly valid. So, &lt;strong&gt;what exactly do a bare asterisk and slash mean in a Python function definition?&lt;/strong&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-asterisk-and-slash-special-parameters-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-python-asterisk-and-slash-special-parameters-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the free sample code&lt;/a&gt; for using the bare asterisk and slash as special parameters in your Python functions.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;in-short-the-python-asterisk-and-slash-control-how-to-pass-values-to-functions&quot;&gt;In Short: The Python Asterisk and Slash Control How to Pass Values to Functions&lt;a class=&quot;headerlink&quot; href=&quot;#in-short-the-python-asterisk-and-slash-control-how-to-pass-values-to-functions&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;The asterisk (&lt;code&gt;*&lt;/code&gt;) and forward slash (&lt;code&gt;/&lt;/code&gt;) define whether you can pass &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/#positional-arguments&quot;&gt;positional&lt;/a&gt; or &lt;a href=&quot;https://realpython.com/defining-your-own-python-function/#keyword-only-arguments&quot;&gt;keyword&lt;/a&gt; arguments to your functions.&lt;/p&gt;
&lt;p&gt;You use a &lt;strong&gt;bare asterisk&lt;/strong&gt; to define a boundary between arguments that you can pass by either position or keyword from those that you must pass by keyword. You use the &lt;strong&gt;slash&lt;/strong&gt; to define a boundary between those arguments that you must pass by position from those that you can pass by either position or keyword. Here’s a visual that summarizes how to use these symbols:&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 class=&quot;text-center&quot;&gt;Left side&lt;/th&gt;
&lt;th class=&quot;text-center&quot;&gt;Divider&lt;/th&gt;
&lt;th class=&quot;text-center&quot;&gt;Right side&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td class=&quot;text-center&quot;&gt;Positional-only arguments&lt;/td&gt;
&lt;td class=&quot;text-center&quot;&gt;&lt;strong&gt;&lt;code&gt;/&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td class=&quot;text-center&quot;&gt;Positional or keyword arguments&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td class=&quot;text-center&quot;&gt;Positional or keyword arguments&lt;/td&gt;
&lt;td class=&quot;text-center&quot;&gt;&lt;strong&gt;&lt;code&gt;*&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td class=&quot;text-center&quot;&gt;Keyword-only arguments&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p&gt;You can also use both symbols together. You’ll learn more about this last point later, but for now take a look at the uses of both symbols individually.&lt;/p&gt;
&lt;p&gt;Suppose you write an &lt;code&gt;asterisk_usage()&lt;/code&gt; function with an asterisk as one of its parameters. Then you call it:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&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;asterisk_usage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;either&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;n&quot;&gt;keyword_only&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;either&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;keyword_only&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;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;asterisk_usage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;either&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Frank&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;keyword_only&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Dean&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Frank Dean&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;asterisk_usage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Frank&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;keyword_only&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Dean&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Frank Dean&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;asterisk_usage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Frank&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Dean&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gt&quot;&gt;Traceback (most recent call last):&lt;/span&gt;
  File &lt;span class=&quot;nb&quot;&gt;&quot;&amp;lt;stdin&amp;gt;&quot;&lt;/span&gt;, line &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;, in &lt;span class=&quot;n&quot;&gt;&amp;lt;module&amp;gt;&lt;/span&gt;
&lt;span class=&quot;gr&quot;&gt;TypeError&lt;/span&gt;: &lt;span class=&quot;n&quot;&gt;asterisk_usage() takes 1 positional argument but 2 were given&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You define your function’s &lt;code&gt;either&lt;/code&gt; parameter before the asterisk, meaning that you can pass arguments to it by keyword or position. Your function’s &lt;code&gt;keyword_only&lt;/code&gt; parameter can accept arguments by keyword only because you defined it after the asterisk. Your first two function calls succeed because you pass the second argument by keyword. Notice that passing the first argument by keyword or position works just fine.&lt;/p&gt;
&lt;p&gt;Your third function call fails because you attempted to pass the second argument by position. The error message tells you that you’ve used one too many positional arguments.&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;: If you decide to use the asterisk, then you can’t use it as the final parameter in your function. The asterisk is designed to force you to pass all subsequent parameters by keyword. If you place it last, then there can be no subsequent parameters:  &lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&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;print_three_members&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;member1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;member2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
  File &lt;span class=&quot;nb&quot;&gt;&quot;&amp;lt;stdin&amp;gt;&quot;&lt;/span&gt;, line &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;
&lt;span class=&quot;w&quot;&gt;    &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;print_three_members&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;member1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;member2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;w&quot;&gt;                                              &lt;/span&gt;&lt;span class=&quot;pm&quot;&gt;^&lt;/span&gt;
&lt;span class=&quot;gr&quot;&gt;SyntaxError&lt;/span&gt;: &lt;span class=&quot;n&quot;&gt;named arguments must follow bare *&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;As you can see above, you won’t get past the function definition line.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Now suppose you write a &lt;code&gt;slash_usage()&lt;/code&gt; function with a slash as part of its header. Try it out:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&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;slash_usage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;positional_only&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&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;n&quot;&gt;either&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;positional_only&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;either&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;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;slash_usage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Frank&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;either&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Dean&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Frank Dean&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;slash_usage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;positional_only&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Frank&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;either&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Dean&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;gt&quot;&gt;Traceback (most recent call last):&lt;/span&gt;
  File &lt;span class=&quot;nb&quot;&gt;&quot;&amp;lt;stdin&amp;gt;&quot;&lt;/span&gt;, line &lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;, in &lt;span class=&quot;n&quot;&gt;&amp;lt;module&amp;gt;&lt;/span&gt;
&lt;span class=&quot;gr&quot;&gt;TypeError&lt;/span&gt;: &lt;span class=&quot;n&quot;&gt;slash_usage() got some positional-only arguments&lt;/span&gt;
&lt;span class=&quot;x&quot;&gt;passed as keyword arguments: &#x27;positional_only&#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;slash_usage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Frank&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Dean&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Frank Dean&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;This time, you used the slash to ensure that you must pass any preceding arguments by position. When you pass in &lt;code&gt;positional_only&lt;/code&gt; by position, your call works. However, when you pass the same argument by keyword, your call fails. Your final function call shows that you can pass the &lt;code&gt;either&lt;/code&gt; argument by either position or by keyword.&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; The Python documentation refers to &lt;code&gt;*&lt;/code&gt; and &lt;code&gt;/&lt;/code&gt; as both &lt;em&gt;symbols&lt;/em&gt; and &lt;em&gt;special parameters&lt;/em&gt;. In this tutorial, you’ll see both terms where appropriate. The term &lt;em&gt;operators&lt;/em&gt; will only refer to their use in multiplication and division. Also, the term &lt;em&gt;arguments&lt;/em&gt; will refer to the data that you’re passing to a function, while &lt;em&gt;parameters&lt;/em&gt; will refer to the function header placeholders that are receiving it.  &lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://peps.python.org/pep-3102/&quot;&gt;PEP 3102 – Keyword-Only Arguments&lt;/a&gt; defines the use of the asterisk in terms of an argument, while &lt;a href=&quot;https://peps.python.org/pep-0570/&quot;&gt;PEP 570 – Python Positional-Only Parameters&lt;/a&gt; defines the slash in terms of a parameter, although &lt;em&gt;symbol&lt;/em&gt; also shows up briefly. PEP 570 also uses the words &lt;em&gt;parameter&lt;/em&gt; and &lt;em&gt;argument&lt;/em&gt; interchangeably.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Now you know how to use the asterisk and slash when defining your own function. But perhaps you have some questions about what kinds of functions these enable you to write, and maybe you’re also thinking about the asterisk in &lt;code&gt;*args&lt;/code&gt;. Keep reading for answers!&lt;/p&gt;
&lt;h2 id=&quot;can-you-write-a-function-that-accepts-only-keyword-arguments&quot;&gt;Can You Write a Function That Accepts Only Keyword Arguments?&lt;a class=&quot;headerlink&quot; href=&quot;#can-you-write-a-function-that-accepts-only-keyword-arguments&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Earlier, you learned that you can’t include the asterisk as the final parameter when defining your function. So you might be surprised to learn that it &lt;em&gt;can&lt;/em&gt; be your first parameter. In that case, you’re specifying that your function will only accept keyword arguments.&lt;/p&gt;
&lt;p&gt;In Python, a keyword argument is one that you pass to a function using its parameter name—for example, &lt;code&gt;first_name=&quot;Dean&quot;&lt;/code&gt;. Passing your arguments by keyword makes your code more readable and also makes using the function more meaningful to your users. You can pass keyword arguments in any order, but they must come after positional arguments, if applicable.&lt;/p&gt;
&lt;p&gt;You already know that parameters defined after the asterisk only take keyword arguments. To write a function that only accepts keyword arguments, you define the asterisk special parameter first:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/python-asterisk-and-slash-special-parameters/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/python-asterisk-and-slash-special-parameters/ »&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 #168: Common Python Stumbling Blocks &amp; Quirky Behaviors</title>
      <id>https://realpython.com/podcasts/rpp/168/</id>
      <link href="https://realpython.com/podcasts/rpp/168/"/>
      <updated>2023-08-11T12:00:00+00:00</updated>
      <summary>Have you ever encountered strange behavior when trying something new in Python? What are common quirks hiding within the language? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;Have you ever encountered strange behavior when trying something new in Python? What are common quirks hiding within the language? This week on the show, Christopher Trudeau is here, 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>Prompt Engineering: A Practical Example</title>
      <id>https://realpython.com/practical-prompt-engineering/</id>
      <link href="https://realpython.com/practical-prompt-engineering/"/>
      <updated>2023-08-09T14:00:00+00:00</updated>
      <summary>Learn prompt engineering techniques with a practical, real-world project to get better results from large language models. This tutorial covers zero-shot and few-shot prompting, delimiters, numbered steps, role prompts, chain-of-thought prompting, and more. Improve your LLM-assisted projects today.</summary>
      <content type="html">
        &lt;div&gt;&lt;p&gt;You’ve used &lt;a href=&quot;https://realpython.com/chatgpt-coding-mentor-python/&quot;&gt;ChatGPT&lt;/a&gt;, and you understand the potential of using a &lt;strong&gt;large language model (LLM)&lt;/strong&gt; to assist you in your tasks. Maybe you’re already working on an LLM-supported application and read about &lt;strong&gt;prompt engineering&lt;/strong&gt;, but you’re unsure how to translate the theoretical concepts into a practical example.&lt;/p&gt;
&lt;p&gt;Your text prompt instructs the LLM’s responses, so tweaking it can get you vastly different output. In this tutorial, you’ll apply multiple &lt;strong&gt;prompt engineering techniques&lt;/strong&gt; to a real-world example. You’ll experience prompt engineering as an iterative process, see the effects of applying various techniques, and learn about related concepts from machine learning and data engineering.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this tutorial, you’ll learn how to:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Work with OpenAI’s &lt;strong&gt;GPT-3.5&lt;/strong&gt; and &lt;strong&gt;GPT-4&lt;/strong&gt; models through their &lt;strong&gt;API&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Apply prompt engineering techniques to a &lt;strong&gt;practical, real-world example&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;numbered steps&lt;/strong&gt;, &lt;strong&gt;delimiters&lt;/strong&gt;, and &lt;strong&gt;few-shot prompting&lt;/strong&gt; to improve your results&lt;/li&gt;
&lt;li&gt;Understand and use &lt;strong&gt;chain-of-thought prompting&lt;/strong&gt; to add more context&lt;/li&gt;
&lt;li&gt;Tap into the power of &lt;strong&gt;roles&lt;/strong&gt; in messages to go beyond using singular &lt;strong&gt;role prompts&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You’ll work with a &lt;strong&gt;Python script&lt;/strong&gt; that you can repurpose to fit your own LLM-assisted task. So if you’d like to use practical examples to discover how you can use prompt engineering to get better results from an LLM, then you’ve found the right 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 Sample Code:&lt;/strong&gt; &lt;a href=&quot;https://realpython.com/bonus/practical-prompt-engineering-code/&quot; class=&quot;alert-link&quot; data-toggle=&quot;modal&quot; data-target=&quot;#modal-practical-prompt-engineering-code&quot; data-focus=&quot;false&quot; markdown=&quot;1&quot;&gt;Click here to download the sample code&lt;/a&gt; that you’ll use to get the most out of large language models through prompt engineering.&lt;/p&gt;
&lt;/div&gt;
&lt;h2 id=&quot;understand-the-purpose-of-prompt-engineering&quot;&gt;Understand the Purpose of Prompt Engineering&lt;a class=&quot;headerlink&quot; href=&quot;#understand-the-purpose-of-prompt-engineering&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;Prompt engineering is more than a buzzword. You can get vastly different output from an LLM when using different prompts. That may seem obvious when you consider that you get different output when you ask different questions—but it also applies to phrasing the same conceptual question differently. Prompt engineering means constructing your text input to the LLM using specific approaches.&lt;/p&gt;
&lt;p&gt;You can think of prompts as arguments and the LLM as the function that you pass these arguments to. Different input means different output:&lt;/p&gt;
&lt;div class=&quot;highlight python repl&quot;&gt;&lt;span class=&quot;repl-toggle&quot; title=&quot;Toggle REPL prompts and output&quot;&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&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;hello&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&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;sa&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Hello, &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;si&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;!&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;gp&quot;&gt;&amp;gt;&amp;gt;&amp;gt; &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;hello&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;World&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Hello, World!&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;hello&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;Engineer&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;go&quot;&gt;Hello, Engineer!&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;While an LLM is much more complex than the toy function above, the fundamental idea holds true. For a successful function call, you’ll need to know exactly which argument will produce the desired output. In the case of an LLM, that argument is text that consists of many different &lt;strong&gt;tokens&lt;/strong&gt;, or &lt;a href=&quot;https://help.openai.com/en/articles/4936856-what-are-tokens-and-how-to-count-them&quot;&gt;pieces of words&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; The analogy of a function and its arguments has a caveat when dealing with OpenAI’s LLMs. While the &lt;code&gt;hello()&lt;/code&gt; function above will always return the same result given the same input, the results of your LLM interactions won’t be 100 percent deterministic. This is currently inherent to how these models operate.&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;The field of prompt engineering is still changing rapidly, and there’s a lot of active research happening in this area. As LLMs continue to evolve, so will the prompting approaches that will help you achieve the best results.&lt;/p&gt;
&lt;p&gt;In this tutorial, you’ll cover some prompt engineering techniques, along with approaches to iteratively developing prompts, that you can use to get better text completions for your own LLM-assisted projects:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#describe-your-task&quot;&gt;Zero-Shot Prompting&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#use-few-shot-prompting-to-improve-output&quot;&gt;Few-Shot Prompting&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#use-delimiters-to-clearly-mark-sections-of-your-prompt&quot;&gt;Delimiters&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#describe-your-request-in-numbered-steps&quot;&gt;Numbered Steps&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#increase-the-steps-for-more-specificity&quot;&gt;Increased Specificity&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#add-a-role-prompt-to-set-the-tone&quot;&gt;Role Prompts&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#walk-the-model-through-chain-of-thought-prompting&quot;&gt;Chain-of-Thought (CoT) Prompting&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#structure-your-output-format-as-json&quot;&gt;Structured Output&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#improve-your-output-with-the-power-of-conversation&quot;&gt;Labeled Conversations&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;There are more techniques to uncover, and you’ll also find links to additional resources in the tutorial. Applying the mentioned techniques in a practical example will give you a great starting point for improving your LLM-supported programs. If you’ve never worked with an LLM before, then you may want to peruse &lt;a href=&quot;https://platform.openai.com/docs/guides/gpt&quot;&gt;OpenAI’s GPT documentation&lt;/a&gt; before diving in, but you should be able to follow along either way.&lt;/p&gt;
&lt;h2 id=&quot;get-to-know-the-practical-prompt-engineering-project&quot;&gt;Get to Know the Practical Prompt Engineering Project&lt;a class=&quot;headerlink&quot; href=&quot;#get-to-know-the-practical-prompt-engineering-project&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;You’ll explore various prompt engineering techniques in service of a practical example: &lt;a href=&quot;https://en.wikipedia.org/wiki/Data_sanitization&quot;&gt;sanitizing&lt;/a&gt; customer chat conversations. By practicing different prompt engineering techniques on a single real-world project, you’ll get a good idea of why you might want to use one technique over another and how you can apply them in practice.&lt;/p&gt;
&lt;p&gt;Imagine that you’re the resident Python developer at a company that handles thousands of customer support chats on a daily basis. Your job is to format and sanitize these conversations. You should also help with deciding which of them require additional attention.&lt;/p&gt;
&lt;h3 id=&quot;collect-your-tasks&quot;&gt;Collect Your Tasks&lt;a class=&quot;headerlink&quot; href=&quot;#collect-your-tasks&quot; title=&quot;Permanent link&quot;&gt;&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Your big-picture assignment is to help your company stay on top of handling customer chat conversations. The conversations that you work with may look like the one shown below:&lt;/p&gt;
&lt;div class=&quot;highlight text&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;[support_tom] 2023-07-24T10:02:23+00:00 : What can I help you with?
[johndoe] 2023-07-24T10:03:15+00:00 : I CAN&#x27;T CONNECT TO MY BLASTED ACCOUNT
[support_tom] 2023-07-24T10:03:30+00:00 : Are you sure it&#x27;s not your caps lock?
[johndoe] 2023-07-24T10:04:03+00:00 : Blast! You&#x27;re right!
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;You’re supposed to make these text conversations more accessible for further processing by the customer support department in a few different ways:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Remove personally identifiable information.&lt;/li&gt;
&lt;li&gt;Remove swear words.&lt;/li&gt;
&lt;li&gt;Clean the date-time information to only show the date.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The swear words that you’ll encounter in this tutorial won’t be spicy at all, but you can consider them stand-ins for more explicit phrasing that you might find out in the wild. After sanitizing the chat conversation, you’d expect it to look like this:&lt;/p&gt;
&lt;/div&gt;&lt;h2&gt;&lt;a href=&quot;https://realpython.com/practical-prompt-engineering/?utm_source=realpython&amp;utm_medium=rss&quot;&gt;Read the full article at https://realpython.com/practical-prompt-engineering/ »&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>What Does if __name__ == &quot;__main__&quot; Mean in Python?</title>
      <id>https://realpython.com/courses/if-name-main-python/</id>
      <link href="https://realpython.com/courses/if-name-main-python/"/>
      <updated>2023-08-08T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn all about Python&#x27;s name-main idiom. You&#x27;ll learn what it does in Python, how it works, when to use it, when to avoid it, and how to refer to it.</summary>
      <content type="html">
        &lt;p&gt;You&amp;rsquo;ve likely encountered Python&amp;rsquo;s &lt;code&gt;if __name__ == &quot;__main__&quot;&lt;/code&gt; idiom when reading other people&amp;rsquo;s code. You might have even used &lt;code&gt;if __name__ == &quot;__main__&quot;&lt;/code&gt; in your own scripts. But did you use it correctly?&lt;/p&gt;
&lt;p&gt;This line of code can seem a little cryptic, so don&amp;rsquo;t fret if you&amp;rsquo;re not completely sure &lt;strong&gt;what&lt;/strong&gt; it does, &lt;strong&gt;why&lt;/strong&gt; you might want it, and &lt;strong&gt;when&lt;/strong&gt; to use it.&lt;/p&gt;
&lt;p&gt;In this video course, you&amp;rsquo;ll learn all about Python&amp;rsquo;s &lt;code&gt;if __name__ == &quot;__main__&quot;&lt;/code&gt; idiom.&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 #167: Exploring pandas 2.0 &amp; Targets for Apache Arrow</title>
      <id>https://realpython.com/podcasts/rpp/167/</id>
      <link href="https://realpython.com/podcasts/rpp/167/"/>
      <updated>2023-08-04T12:00:00+00:00</updated>
      <summary>What are the new ways to describe your data in pandas 2.0? Will the addition of Apache Arrow to the data back end foster the growth of data interoperability? This week on the show, we talk with pandas core developer Marc Garcia about the release of pandas 2.0.</summary>
      <content type="html">
        &lt;p&gt;What are the new ways to describe your data in pandas 2.0? Will the addition of Apache Arrow to the data back end foster the growth of data interoperability? This week on the show, we talk with pandas core developer Marc Garcia about the release of pandas 2.0.&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>Reversing Strings in Python</title>
      <id>https://realpython.com/courses/python-reverse-string/</id>
      <link href="https://realpython.com/courses/python-reverse-string/"/>
      <updated>2023-08-01T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn how to reverse strings in Python by using available tools such as reversed() and slicing operations. You&#x27;ll also learn how to build reversed strings by hand.</summary>
      <content type="html">
        &lt;p&gt;When you&amp;rsquo;re using Python strings often in your code, you may face the need to work with them in &lt;strong&gt;reverse order&lt;/strong&gt;. Python includes a few handy tools and techniques that can help you out in these situations. With them, you&amp;rsquo;ll be able to build reversed copies of existing strings quickly and efficiently.&lt;/p&gt;
&lt;p&gt;Knowing about these tools and techniques for reversing strings in Python will help you improve your proficiency as a Python developer.&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;Quickly build reversed strings through &lt;strong&gt;slicing&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Create &lt;strong&gt;reversed copies&lt;/strong&gt; of existing strings using &lt;code&gt;reversed()&lt;/code&gt; and &lt;code&gt;.join()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Use &lt;strong&gt;iteration&lt;/strong&gt; to reverse existing strings manually&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To make the most out of this course, you should know the basics of &lt;a href=&quot;https://realpython.com/python-strings/&quot;&gt;strings&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-for-loop/&quot;&gt;&lt;code&gt;for&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;https://realpython.com/python-while-loop/&quot;&gt;&lt;code&gt;while&lt;/code&gt;&lt;/a&gt; loops.&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 #166: Differentiating the Versions of Python &amp; Unlocking IPython&#x27;s Magic</title>
      <id>https://realpython.com/podcasts/rpp/166/</id>
      <link href="https://realpython.com/podcasts/rpp/166/"/>
      <updated>2023-07-28T12:00:00+00:00</updated>
      <summary>What are all the different versions of Python? You may have heard of Cython, Brython, PyPy, or others and wondered where they fit into the Python landscape. This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;What are all the different versions of Python? You may have heard of Cython, Brython, PyPy, or others and wondered where they fit into the Python landscape. This week on the show, Christopher Trudeau is here, 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>Socket Programming in Python Part 1: Handling Connections</title>
      <id>https://realpython.com/courses/python-sockets-part-1/</id>
      <link href="https://realpython.com/courses/python-sockets-part-1/"/>
      <updated>2023-07-25T14:00:00+00:00</updated>
      <summary>In this video course, you&#x27;ll learn how to build a socket server and client with Python. Along the way, you&#x27;ll get to know the main functions and methods in Python&#x27;s socket module, and you&#x27;ll implement a multi-connection server and client.</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 with your ISP.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;In this two-part series, 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;p&gt;By the end of part one, you&amp;rsquo;ll understand how to use the main functions and methods in Python&amp;rsquo;s &lt;a href=&quot;https://docs.python.org/3/library/socket.html&quot;&gt;socket module&lt;/a&gt; to write your own client-server applications, including ones with multiple connections. In part two, you&amp;rsquo;ll dive into building a custom class and handling errors.&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 #165: Leveraging the Features of Your Database With Postgres and Python</title>
      <id>https://realpython.com/podcasts/rpp/165/</id>
      <link href="https://realpython.com/podcasts/rpp/165/"/>
      <updated>2023-07-21T12:00:00+00:00</updated>
      <summary>Are you getting the most out of your Postgres database? What features could you leverage to improve your Python project? This week on the show, Craig Kerstiens from Crunchy Data is here to discuss getting the most out of Postgres.</summary>
      <content type="html">
        &lt;p&gt;Are you getting the most out of your Postgres database? What features could you leverage to improve your Python project? This week on the show, Craig Kerstiens from Crunchy Data is here to discuss getting the most out of Postgres.&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>Creating Web Maps From Your Data With Python Folium</title>
      <id>https://realpython.com/courses/python-folium-web-maps-from-data/</id>
      <link href="https://realpython.com/courses/python-folium-web-maps-from-data/"/>
      <updated>2023-07-18T14:00:00+00:00</updated>
      <summary>You&#x27;ll learn how to create web maps from data using Folium. The package combines Python&#x27;s data-wrangling strengths with the data-visualization power of the JavaScript library Leaflet. In this video course, you&#x27;ll create and style a choropleth world map showing the ecological footprint per country.</summary>
      <content type="html">
        &lt;p&gt;If you&amp;rsquo;re working with geospatial data in Python, then you might want to quickly visualize that data on a map. Python&amp;rsquo;s Folium library gives you access to the mapping strengths of the &lt;a href=&quot;https://leafletjs.com/&quot;&gt;Leaflet&lt;/a&gt; JavaScript library through a Python API. It allows you to create interactive geographic visualizations that you can &lt;a href=&quot;https://realpython.github.io/ecological-footprint/&quot;&gt;share as a website&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You&amp;rsquo;ll build a web map that displays the &lt;a href=&quot;https://en.wikipedia.org/wiki/Ecological_footprint&quot;&gt;ecological footprint&lt;/a&gt; per capita of many countries and is based on a &lt;a href=&quot;https://en.wikipedia.org/wiki/List_of_countries_by_ecological_footprint#/media/File:Ecological_footprint_2018.png&quot;&gt;similar map on Wikipedia&lt;/a&gt;. Along the way, you&amp;rsquo;ll learn the basics of using Folium for data visualization.&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;Create an &lt;strong&gt;interactive map&lt;/strong&gt; using Folium and save it as an &lt;strong&gt;HTML&lt;/strong&gt; file&lt;/li&gt;
&lt;li&gt;Choose from different &lt;strong&gt;web map tiles&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Anchor your map to a &lt;strong&gt;specific geolocation&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Bind data&lt;/strong&gt; to a &lt;strong&gt;GeoJSON&lt;/strong&gt; layer to create a &lt;strong&gt;choropleth map&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Style&lt;/strong&gt; the choropleth map&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You&amp;rsquo;ll use Folium inside of a &lt;a href=&quot;https://realpython.com/jupyter-notebook-introduction/&quot;&gt;Jupyter notebook&lt;/a&gt;, so the Folium library will render your maps directly in the Jupyter notebook. This gives you a good opportunity to visually explore a geographical dataset or include a map in your data science report.&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 #164: Constructing Python Library APIs &amp; Tackling Jinja Templating</title>
      <id>https://realpython.com/podcasts/rpp/164/</id>
      <link href="https://realpython.com/podcasts/rpp/164/"/>
      <updated>2023-07-14T12:00:00+00:00</updated>
      <summary>What principles should you consider when designing a Python library? How do you construct a library API that&#x27;s understandable and easy to use? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;What principles should you consider when designing a Python library? How do you construct a library API that&#x27;s understandable and easy to use? This week on the show, Christopher Trudeau is here, 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>Mazes in Python Part 2: Storing and Solving</title>
      <id>https://realpython.com/courses/python-maze-solver-part-2/</id>
      <link href="https://realpython.com/courses/python-maze-solver-part-2/"/>
      <updated>2023-07-11T14:00:00+00:00</updated>
      <summary>In part two of this two-part project, you&#x27;ll define a specialized binary file format to store a maze on disk, transform the maze into a traversable weighted graph, and use a graph search algorithm in the NetworkX library to find the solution.</summary>
      <content type="html">
        &lt;p&gt;If you&amp;rsquo;re up for a little challenge and would like to take your programming skills to the next level, then you&amp;rsquo;ve come to the right place! In this hands-on video course, you&amp;rsquo;ll practice object-oriented programming, among several other good practices, while building a cool maze solver project in Python.&lt;/p&gt;
&lt;p&gt;This is the second part in a two-part series. Throughout the series, you&amp;rsquo;re going step by step through the guided process of building a complete and working project. This includes reading a maze from a binary file, visualizing it using scalable vector graphics (SVG), and finding the shortest path from the entrance to the exit. &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;Define a specialized &lt;strong&gt;binary file format&lt;/strong&gt; to store the maze on disk&lt;/li&gt;
&lt;li&gt;Transform the maze into a traversable &lt;strong&gt;weighted graph&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Use a &lt;strong&gt;graph search algorithm&lt;/strong&gt; in the NetworkX library to find the solution.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To get the most out of this video course, make sure you&amp;rsquo;ve completed &lt;a href=&quot;https://realpython.com/courses/python-maze-solver-part-1/&quot;&gt;Part 1: Building and Visualizing&lt;/a&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>The Real Python Podcast – Episode #163: Python Crash Course &amp; Learning Enough to Start Creating</title>
      <id>https://realpython.com/podcasts/rpp/163/</id>
      <link href="https://realpython.com/podcasts/rpp/163/"/>
      <updated>2023-07-07T12:00:00+00:00</updated>
      <summary>How much Python do you need to learn to start creating projects? What&#x27;s a good balance of information and hands-on practice? This week on the show, Eric Matthes is here to discuss his book Python Crash Course.</summary>
      <content type="html">
        &lt;p&gt;How much Python do you need to learn to start creating projects? What&#x27;s a good balance of information and hands-on practice? This week on the show, Eric Matthes is here to discuss his book Python Crash Course.&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 #162: Exploring the Zen of Python &amp; pandas Features for Finance</title>
      <id>https://realpython.com/podcasts/rpp/162/</id>
      <link href="https://realpython.com/podcasts/rpp/162/"/>
      <updated>2023-06-30T12:00:00+00:00</updated>
      <summary>What advice can you extract from the Zen of Python? How can these nineteen guiding principles help you write more idiomatic Python? This week on the show, Christopher Trudeau is here, bringing another batch of PyCoder&#x27;s Weekly articles and projects.</summary>
      <content type="html">
        &lt;p&gt;What advice can you extract from the Zen of Python? How can these nineteen guiding principles help you write more idiomatic Python? This week on the show, Christopher Trudeau is here, 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>
  

</feed>
