Use with block for file output

This commit is contained in:
Nick Hall 2016-06-15 21:48:17 +01:00
parent 2d2ee2939c
commit f172ca8672

View File

@ -201,7 +201,7 @@ class OptionListCollection:
"""
Saves the current OptionListCollection to the associated file.
"""
file = open(self.filename, "w", encoding="utf-8")
with open(self.filename, "w", encoding="utf-8") as file:
file.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
file.write('<options>\n')
@ -249,7 +249,6 @@ class OptionListCollection:
file.write('</module>\n')
file.write('</options>\n')
file.close()
def parse(self):
"""