Categories
Why doesn't file.read() work the way I want it to?
I have a file status.txtthat contains only one word, for example nothing Question: why does it open('status.txt', 'w+').read() == 'nothing'return false? And how to fix it?
status.txt
open('status.txt', 'w+').read() == 'nothing'
Answer the question
In order to leave comments, you need to log in
You are opening the file for writing, not for reading. You need to do something like this: open('status.txt', 'r').read() == 'nothing'
open('status.txt', 'r').read() == 'nothing'
Didn't find what you were looking for?
Ask a Question
731 491 924 answers to any question