why can't I print the xml-data, which is written into a file, in plain text???
I have the code https://code.sololearn.com/c3UT506idZ0Z/?ref=app and I want to print the generated xml-data, which is saved as a file, as plain text. But why do I not get an output? And how to solve the problem? What am I doing wrong?
Ruba Kh Arsenic Guys, thank you very much. 🙂👍👍👍 I know where I did make the mistake: I am very often used to use the context-manager with open('fname', 'mode') as file: # do something # do even more Special feature of the context manager is, that you don't have to worry about closing the file, because it closes the file automatically when having finished, even in an error-cased exception. But my mistake was, that in this case there is no context manager involved, and I lost sight of closing the file. 😳 I should not code in bed on the phone at 1 AM at night... 😁😁😁
That's OK Jan Markus 😌 I can't concentrate at 1 AM either.
try closing the file after writing before openning it again myfile.close()