def save(self): data = {'keyname': self.keyname, 'rows': self.rows} #backup the existing file if os.path.exists(self.file_path): shutil.copy2(self.file_path, self.file_path+'.bk') common.write_json(self.file_path, data)
def write_json(self, filename, data): common.write_json(self.join_path(filename), data) return self
def save(self): data = {'keyname': self.keyname, 'rows': self.rows} #backup the existing file if os.path.exists(self.file_path): shutil.copy2(self.file_path, self.file_path + '.bk') common.write_json(self.file_path, data)