You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
bubokko
changed the title
Incorrect sagt
Incorrect statement about new lines in files
Jan 9, 2025
On page 185 of the 3rd edition, the books claims:
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.The text was updated successfully, but these errors were encountered: