Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect statement about new lines in files #106

Open
bubokko opened this issue Jan 9, 2025 · 0 comments
Open

Incorrect statement about new lines in files #106

bubokko opened this issue Jan 9, 2025 · 0 comments

Comments

@bubokko
Copy link

bubokko commented Jan 9, 2025

On page 185 of the 3rd edition, the books claims:

The only difference between this output and the original file is the extra blank line at the end of the output. The blank line appears because read_text() returns an empty string when it reaches the end of the file; this empty string shows up as a blank line.

I think this is not correct. It has nothing to do with reaching the end of the file. The new line character is there in the file: pi_digits.txt (not displayed on GitHub, but it's there). If we remove it, the blank line will no longer be printed.

I'd be a bit confused by this statement if I was a new programmer, I'd think that read_text() does something special about how it handles the end of the file, when in fact it doesn't.

@bubokko bubokko changed the title Incorrect sagt Incorrect statement about new lines in files Jan 9, 2025
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

No branches or pull requests

1 participant