Python tutorials

Build a Site Connectivity Checker in Python

Building a site connectivity checker in Python is an interesting project to level up your skills. With this project, you’ll integrate knowledge related to handling HTTP requests, creating command-line interfaces (CLI), and organizing your application’s code using common Python project layout practices. By building this project, you’ll learn how Python’s asynchronous features can help you deal with multiple HTTP requests efficiently. In this tutorial, you’ll learn how to: Create command-line interfaces (CLI) using Python’s argparse Check if a website is […]

Read more

Python REST APIs With FastAPI

Creating APIs, or application programming interfaces, is an important part of making your software accessible to a broad range of users. In this video course, you’ll learn the main concepts of FastAPI and how to use it to quickly create web APIs that implement best practices by default. By the end of it, you’ll be able to start creating production-ready web APIs, and you’ll have the understanding needed to go deeper and learn more for your specific use cases. In […]

Read more

YAML: The Missing Battery in Python

Python is often marketed as a batteries-included language because it comes with almost everything you’d ever expect from a programming language. This statement is mostly true, as the standard library and the external modules cover a broad spectrum of programming needs. However, Python lacks built-in support for the YAML data format, commonly used for configuration and serialization, despite clear similarities between the two languages. In this tutorial, you’ll learn how to work with YAML in Python using the available third-party […]

Read more

Python GUI Programming With Tkinter

Python has a lot of GUI frameworks, but Tkinter is the only framework that’s built into the Python standard library. Tkinter has several strengths. It’s cross-platform, so the same code works on Windows, macOS, and Linux. Visual elements are rendered using native operating system elements, so applications built with Tkinter look like they belong on the platform where they’re run. Although Tkinter is considered the de facto Python GUI framework, it’s not without criticism. One notable criticism is that GUIs […]

Read more

Using Python’s datetime Module

Python has several different modules to deal with dates and times. This course concentrates on the primary one, datetime. Dates and times are messy things! Shifts due to daylight savings time and time zones complicate any computing with dates and times. In this course, you’ll tackle that messiness and learn: How to use the datetime module What the zoneinfo module does and how to use it How to calculate the difference between two datetime objects    

Read more

Pagination for a User-Friendly Django App

Django has a Paginator class that comes built in and ready to use. Perhaps you have a project on the go, and you’d like to try out the pagination implementations in the following sections with your app as your base. No problem! However, if you want to follow the step-by-step code examples in this tutorial, then you can download the source code for the Django Python wiki project from the Real Python materials repository: This wiki project contains an app […]

Read more

Please stop writing shell scripts

When you’re automating some task, for example packaging your application for Docker, you’ll often find yourself writing shell scripts. You might have a bash script to drive the packaging process, and another script as an entry point for the container. As your packaging grows in complexity, so does your shell script. Everything works fine. And then, one day, your shell script does something completely wrong. That’s when you realize your mistake: bash, and shell scripting languages in general, are mostly […]

Read more

Image Processing With the Python Pillow Library

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 tutorial, you’ll learn how to manipulate images and perform basic image processing using the Python Pillow library. 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 […]

Read more

Python Basics: Code Your First Python Program

In the previous Python Basics video course, you set up Python on your computer. With Python installed, you’re ready ready to start coding! In this video course, you’ll: Write your first Python program Learn what happens when you run a program with an error Learn how to declare a variable and inspect its value Learn how to write comments This course can be enjoyed alone or as an accompaniment to Python Basics: A Practical Introduction to Python 3. Ready to […]

Read more

Python Timer Functions: Three Ways to Monitor Your Code

Look back at how you added the Python timer to the example above. Note that you need at least one variable (tic) to store the state of the Python timer before you download the tutorial. After studying the code a little, you might also note that the three highlighted lines are added only for timing purposes! Now, you’ll create a class that does the same as your manual calls to perf_counter(), but in a more readable and consistent manner. Throughout […]

Read more
1 97 98 99 100 101 185