> ## Documentation Index
> Fetch the complete documentation index at: https://python-training.ipoint-labs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Module 13: File handling

> Read, write, and append text files safely with with, and process CSV data with the csv module.

| | |
| - | - |
| **Exam** | PCEP-30-03 |
| **Section** | 5. File Handling and Module Imports (14% of the exam) |
| **Objectives** | 5.1.1 and 5.1.2 |
| **Exam questions** | About 2, one per objective |

By the end of this module you can do everything below. The objectives and their wording come from the [official PCEP-30-03 syllabus](https://pythoninstitute.org/pcep-exam-syllabus).

## 5.1.1 Work with text files

* Open text files using appropriate modes, including `r`, `w`, and `a`.
* Read data from a text file.
* Write and append data to a text file.
* Use the `with` statement to manage file access safely.
* Recognize common errors when opening or accessing files.

## 5.1.2 Work with CSV files

* Explain the basic structure of a CSV file.
* Import and use the `csv` module.
* Read CSV data using `csv.reader()`.
* Write CSV data using `csv.writer()`.
* Process rows and values read from a CSV file.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.