Files and File Streams
Learning Path ⋅ Skills: Python, Pathlib, File I/O, Serialization, Encoding, Unicode, PDF, WAV
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
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.
Interactive Quiz
Reading and Writing 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.
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.
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.
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.
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.
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.
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.
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.
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.
Interactive Quiz
Reading and Writing WAV Files in Python
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!