Files and File Streams

Learning PathSkills: Python, Pathlib, File I/O, Serialization, Encoding, Unicode, PDF, WAV

Two people working together, one is inputting data on a computer, the other one is reading a long printout

Master file handling in Python! Learn to read/write files, navigate file systems with pathlib, handle encodings, and download files from URLs. Explore serialization, manage PDFs, and process WAV files. Gain practical skills to manipulate files effectively.

Files and File Streams

Learning Path ⋅ 10 Resources

Title image for Reading and Writing Files in Python (Reading and Writing Files in Python (Guide))

Course

Reading and Writing Files in Python

Learn about reading and writing files in Python. You'll cover everything from what a file is made up of to which libraries can help you along that way. You'll also take a look at some basic scenarios of file usage as well as some advanced techniques.

Title image for Practical Recipes for Working With Files in Python (Working With Files in Python)

Course

Practical Recipes for Working With Files in Python

Learn how you can work with files in Python by using built-in modules to perform practical tasks that involve groups of files, like renaming them, moving them around, archiving them, and getting their metadata.

Title image for Using Python's pathlib Module (Python 3 "pathlib" Module: Taming The Filesystem)

Course

Using Python's pathlib Module

Learn how to effectively work with file system paths in Python 3 using the pathlib module in the standard library.

Title image for Why Is It Important to Close Files in Python? (Why Is It Important to Close Files in Python?)

Tutorial

Why Is It Important to Close Files in Python?

Model citizens use context managers to open and close file resources in Python, but have you ever wondered why it's important to close files? In this tutorial, you'll take a deep dive into the reasons why it's important to close files and what can happen if you don't.

Title image for Serialize Your Data With Python (Serialize Your Data With Python)

Tutorial

Serialize Your Data With Python

In this in-depth tutorial, you'll explore the world of data serialization in Python. You'll compare and use different data serialization formats, serialize Python objects and executable code, and handle HTTP message payloads.

Title image for How to Download Files From URLs With Python (How to Download Files From URLs With Python)

Tutorial

How to Download Files From URLs With Python

In this tutorial, you'll find the right tools to help you download files from URLs with Python and manage the data retrieval process. You'll cover data streaming, thread pools, and asynchronous downloads.

Title image for Unicode in Python: Working With Character Encodings (Unicode & Character Encodings in Python: A Painless Guide)

Course

Unicode in Python: Working With Character Encodings

In this course, you'll get a Python-centric introduction to character encodings and Unicode. Handling character encodings and numbering systems can at times seem painful and complicated, but this guide is here to help with easy-to-follow Python examples.

Title image for How to Sort Unicode Strings Alphabetically in Python (How to Sort Unicode Strings Alphabetically in Python)

Tutorial

How to Sort Unicode Strings Alphabetically in Python

Learn how to correctly sort Unicode strings in Python while avoiding common pitfalls. You'll explore powerful third-party libraries implementing the complete Unicode Collation Algorithm (UCA), as well as standard library modules and a few handmade solutions.

Title image for Create and Modify PDF Files in Python (Creating and Modifying PDF Files in Python)

Tutorial

Create and Modify PDF Files in Python

In this tutorial, you'll explore the different ways of creating and modifying PDF files in Python. You'll learn how to read and extract text, merge and concatenate files, crop and rotate pages, encrypt and decrypt files, and even create PDFs from scratch.

Title image for Reading and Writing WAV Files in Python (Reading and Writing WAV Files in Python)

Tutorial

Reading and Writing WAV Files in Python

Learn how to work with WAV audio files in Python using the standard-library wave module. Along the way, you'll synthesize sounds from scratch, visualize waveforms in the time domain, animate real-time spectrograms, and apply special effects to widen the stereo field.

Got feedback on this learning path?

Looking for real-time conversation? Visit the Real Python Community Chat or join the next “Office Hours” Live Q&A Session. Happy Pythoning!

« Browse All Learning Paths