Hi, I am writing a script that aims to help a person keep a list of characters while reading a book. In doing this, I am writing to a file and checking it constantly, except I ran into a problem. Say I executed a code block such as the following:
infoToWrite = "Harry Potter: Teenage boy who has an owl" myFile = open("characterlist.txt", "r+") myFile.write(infoToWrite)
Now after this code is executed, I notice that my "characterlist.txt" file does not contain the data I just wrote. However, if I were to close the Python shell, the file contains the data.
So, what is causing this? And is there anything I would be able to do to make this file writing instantaneous?
Thanks in advance.