__init__.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:bittyband 作者: yam655 项目源码 文件源码
def backup(self):
        dsecs = self.data_file.stat().st_mtime
        meta_file = Path(self.bits["metadata"])
        msecs = meta_file.stat().st_mtime
        secs = max(dsecs, msecs)
        suffix = filename_iso_time(secs)
        backup_data = self.data_file.with_name("{}-{}{}".format(self.data_file.stem, suffix, self.data_file.suffix))
        backup_meta = meta_file.with_name("{}-{}{}".format(meta_file.stem, suffix, meta_file.suffix))
        with backup_data.open("w", newline='') as csvfile:
            fieldnames = ['location', 'lyric', 'mark', 'track-change', "chord-change", "chord-selection", "note"]
            writer = csv.DictWriter(csvfile, fieldnames=fieldnames, extrasaction='ignore', dialect=ImportCsvDialect)
            writer.writeheader()
            for location in self.order:
                writer.writerow(self.data[location])
        with backup_meta.open('w') as meta:
            self.metadata.write(meta)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号