Python Forum
Newly written .txt file not printing
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Newly written .txt file not printing
#3
You are correct. That error message doesn't correspond with the actual example I posted. I was merely trying to show the error code I got when I tried to place the print(text_file.read()) after the file close command.

What I'm trying to understand is why the lines from the text file only printed once despite my adding additional print commands. It's as if they were ignored by the rest of the code and I was hoping someone could help me understand why that is.

Does it have something to do with the fact that in the first 2 instances those commands were actually writing to the text file as opposed to the last one which seems to work where it is looking at it with the r read option?

and if so am I misunderstaning the write/read capabilities with the w+ option?

Thanks.
Quote:If you can't learn to do something well?... Learn to enjoy doing it poorly.
Reply


Messages In This Thread
Newly written .txt file not printing - by Crackity - Oct-16-2017, 06:23 AM
RE: Newly written .txt file not printing - by buran - Oct-16-2017, 07:11 AM
RE: Newly written .txt file not printing - by Crackity - Oct-16-2017, 10:09 AM
RE: Newly written .txt file not printing - by buran - Oct-16-2017, 11:53 AM
RE: Newly written .txt file not printing - by buran - Oct-16-2017, 12:36 PM
RE: Newly written .txt file not printing - by buran - Oct-20-2017, 06:21 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  My Loop for printing text file goes to infinity Nomex 7 4,411 Feb-10-2020, 03:13 PM
Last Post: buran
  Command line inputs not printing to Log File ijosefson 1 3,412 Oct-19-2017, 06:41 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020