File handling, modes, text vs binary data, `with`, `pathlib`, custom context managers, and `contextlib`
Python file work combines open modes like read, write, and append with text or binary handling, and context managers ensure resources close correctly.
- Use `with` for cleanup
- `pathlib` makes path logic clearer
- `contextlib` helps build reusable context managers
File handling, modes, text vs binary data, `with`, `pathlib`, custom context managers, and `contextlib`