Skip to content

Add read-write-files-python materials folder - #992

Open
realpython-bot wants to merge 1 commit into
masterfrom
maintenance/read-write-files-python-20261203
Open

realpython-bot wants to merge 1 commit into
masterfrom
maintenance/read-write-files-python-20261203

Conversation

@realpython-bot

Copy link
Copy Markdown
Collaborator

Adds the companion code for Reading and Writing Files in Python (Guide). The folder mirrors the full-update draft (Post 2447, admin: https://realpython.com/pbjt/blog/post/2447/change/). Trello card: https://trello.com/c/XlQNNPh9

Contents: one script per tutorial section, with the REPL examples turned into print() calls. It also has the dos2unix.py tool, the png_reader.py context manager, the project/ folder for the __file__ example, and the dog_breeds.txt / jack_russell.png fixtures. The PNG is the CDN-served copy of the article's image, so the chunk listing matches the article. It uses only the standard library, so there's no requirements.txt.

Verification:

  • Ran every script in the article's order on Python 3.15.2 from a fresh copy of the folder.
  • Every output matched the draft, including UnicodeDecodeError, the dos2unix bytes before and after, write_text() returning 196, the PNG chunks, and the __file__ paths.
  • ruff==0.14.1 format and check pass, and dircheck.py passes.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant