def create_file(self, filename): with open(filename, "w+") as file: file.writelines(["line1", "line2", "line3"]) file.flush() file.close()