Mar-02-2018, 07:04 AM
(This post was last modified: Mar-02-2018, 07:04 AM by Gribouillis.)
At line 39 you're not calling the close method! Use
close()
. Note that the read method can be shrunk todef read(self, file_path): with open(file_path, 'r') as stream_reader: return [line.strip() for line in stream_reader if line.strip()]
close()
is run automatically at the end of the with
block. This code also removes blank lines if any.