Office Hours
Join us live for an exclusive members-only Q&A session with the Real Python team. You'll meet fellow Pythonistas to chat about your learning progress, ask questions, and discuss Python tips & tricks via screen sharing. Simply register for upcoming events on this page.
How to Exit Loops Early With the Python Break Keyword
Apr 16, 2025 basicspython
In this tutorial, you'll explore various ways to use Python's break statement to exit a loop early. Through practical examples, such as a student test score analysis tool and a number-guessing game, you'll see how the break statement can improve the efficiency and effectiveness of your code.
Namespaces in Python
Apr 14, 2025 intermediatepython
In this tutorial, you'll learn about Python namespaces, the structures that store and organize the symbolic names during the execution of a Python program. You'll learn when namespaces are created, how they're implemented, and how they support variable scope.
Using Python's .__dict__ to Work With Attributes
Apr 09, 2025 advancedpython
In this tutorial, you'll dive deeper into the .__dict__ attribute in Python objects. This attribute is a dictionary-like object that holds writable class or instance attributes. It allows you to manage attributes at a low level, making your classes flexible and efficient.
Python News Roundup: April 2025
Apr 07, 2025 community
Recent milestones in the Python community include Python 3.14's sixth alpha release and the acceptance of PEP 758. PyCon US has set new records for travel grants, and Thomas Wouters receives recognition for his long-standing contributions. Popular libraries also see significant updates.
How to Strip Characters From a Python String
Apr 02, 2025 basicspython
Use Python's .strip() method to remove unwanted whitespace or specific characters. Learn about common pitfalls, real-world use cases, and compare .strip() with similar methods like .lstrip() and .removesuffix().
Python's Bytearray: A Mutable Sequence of Bytes
Mar 31, 2025 intermediatepython
In this tutorial, you'll learn about Python's bytearray, a mutable sequence of bytes for efficient binary data manipulation. You'll explore how it differs from bytes, how to create and modify bytearray objects, and when to use them in tasks like processing binary files and network protocols.
Introducing DuckDB
Mar 26, 2025 intermediatedatabasesdata-sciencepython
In this showcase tutorial, you'll be introduced to a library that allows you to use a database in your code. DuckDB provides an efficient relational database that supports many features you may already be familiar with from more traditional relational database systems.
Python Code Quality: Best Practices and Tools
Mar 24, 2025 intermediatebest-practicespythontools
In this tutorial, you'll learn about code quality and the key factors that make Python code high-quality. You'll explore effective strategies, powerful tools, and best practices to elevate your code to the next level.
LangGraph: Build Stateful AI Agents in Python
Mar 19, 2025 intermediatedata-science
LangGraph is a versatile Python library designed for stateful, cyclic, and multi-actor Large Language Model (LLM) applications. This tutorial will give you an overview of LangGraph fundamentals through hands-on examples, and the tools needed to build your own LLM workflows and agents in LangGraph.
Python's Instance, Class, and Static Methods Demystified
Mar 17, 2025 intermediatepython
In this tutorial, you'll compare Python's instance methods, class methods, and static methods. You'll gain an understanding of when and how to use each method type to write clear and maintainable object-oriented code.
Python Textual: Build Beautiful UIs in the Terminal
Mar 12, 2025 intermediatefront-endtools
Textual is a Python library for building text-based user interfaces (TUIs) that support rich text, advanced layouts, and event-driven interactivity in the terminal. This tutorial showcases some of the ways you can design an appealing and engaging UI using Textual.
Python News Roundup: March 2025
Mar 10, 2025 community
Last month, Python published the fifth alpha version of the 3.14 series. The PSF shared their online platforms, and PyCon US 2025 published its schedule. Some fundamental Python projects, such as Django and IPython, also released new versions.
Bytes Objects: Handling Binary Data in Python
Mar 05, 2025 intermediatepython
In this tutorial, you'll learn about Python's bytes objects, which help you process low-level binary data. You'll explore how to create and manipulate byte sequences in Python and how to convert between bytes and strings. Additionally, you'll practice this knowledge by coding a few fun examples.
Python while Loops: Repeating Tasks Conditionally
Mar 03, 2025 basicspython
In this tutorial, you'll learn about indefinite iteration using the Python while loop. You'll be able to construct basic and complex while loops, interrupt loop execution with break and continue, use the else clause with a while loop, and deal with infinite loops.
How to Work With Polars LazyFrames
Feb 26, 2025 intermediatebest-practicesdata-science
In this tutorial, you'll gain an understanding of the principles behind Polars LazyFrames. You'll also learn why using LazyFrames is often the preferred option over more traditional DataFrames.
How to Use sorted() and .sort() in Python
Feb 24, 2025 basicspython
In this tutorial, you'll learn how to sort various types of data in different data structures in Python. You'll explore custom sorting orders and work with two distinct ways of sorting.
How to Manage Python Projects With pyproject.toml
Feb 19, 2025 intermediatetools
Learn how to manage Python projects with the pyproject.toml configuration file. In this tutorial, you'll explore key use cases of the pyproject.toml file, including configuring your build, installing your package locally, managing dependencies, and publishing your package to PyPI.
Python News Roundup: February 2025
Feb 17, 2025 community
2025 looks to be an exciting year for Python. A new type of interpreter improves the performance of the upcoming Python 3.14. Additionally, the community is busy developing third-party libraries, challenging each other with new puzzles, and planning conferences.