Skip to main content
grasp.study
About
Explore
Pricing
Log in
Try it for free
Back to course
👋
Welcome to a Grasp lesson
Create a free account
to keep studying and create your own study path.
Create Pythonic Course Content
·
Module 8
Handle the Real World: Files, Paths, and I/O
1
Modern Path Management with `pathlib.Path`
Use `pathlib.Path` for modern, object-oriented, and cross-platform path manipulation instead of `os.path`.
2
Safe File I/O with `with open()` and UTF-8 Encoding
Read and write text files safely using `with open(...)` and explicitly specifying `encoding='utf-8'`.
Parsing Tabular and Structured Data
Parse tabular data using the `csv` module and structured data using the `json` module.
4
Mastering `configparser` for Application Configuration
Manage application configuration using the `configparser` module.
5
Secure Temporary File Handling with `tempfile`
Create and manage temporary files and directories safely using the `tempfile` module.
6
Secure File Management with `shutil` and `subprocess`
Use `shutil` for high-level file operations and `subprocess.run()` safely, avoiding `shell=True` with untrusted input.
Efficiently Processing Large Files
Process large files by streaming line-by-line or in chunks to avoid out-of-memory errors.
8
Pickle Pitfalls: Security, Versioning, and Safer Alternatives
Explain the security and versioning risks of `pickle` and prefer explicit formats like JSON for data persistence.
Previous module
Flatten Your Code: Control Flow Without the Nesting Hell
Next module
Master Error Handling: Exceptions and Logging