Oct-16-2017, 10:09 AM
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
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
and if so am I misunderstaning the write/read capabilities with the
Thanks.
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.