Answer the question
In order to leave comments, you need to log in
Text is not being written to a text file?
Started learning Python. Looked at the lesson on working with files.
create a text document named 'text'. Next, I write the following code:
file = open ('text.txt', 'w')
file.write('Hello')
After that, the word 'Hello' should appear in the file, but it is not there. The python file and the document are in the same folder.
Answer the question
In order to leave comments, you need to log in
Buffer flush to disk then already:
The data is written first to the buffer. From which, in this case, when the file is closed, changes from the buffer are written to disk.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question