![]() ![]() Quoting from the workaround explained at This seems like a bug specific to Windows. I will be grateful if anyone can tell me what I did wrong here or is it just a Pythong thing. I have to declare the same/different open file object before I can perform another read/write action to the same file. If I want to use the same openFile to read files or append something to it. I have no problems if I want write to it the first time. In the example above, openFile is the object used to open file. # I get an error when I use the codes below: Can anyone explain why I am getting such errors and why I cannot use the same openFile object the way shown below. openFile = open("filepath", "r")ĪppendFile = openFile.write("\nTest 123")īut, if I try the following I get a bunch of unknown text in the text file I am writing to. I can understand simple read and write files. I've gone through some tutorials online but I am still confused about it. Started Python a week ago and I have some questions to ask about reading and writing to the same files.
0 Comments
Leave a Reply. |