import_wikdict.py 文件源码

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

项目:tools 作者: freedict 项目源码 文件源码
def update_dict_files(path, shared_file_path):
    dir_template = os.path.join(
            os.path.dirname(os.path.realpath(__file__)),
            'template'
    )
    try:
        tei = next(os.path.join(path, f) for f in os.listdir(path))
        os.remove(tei)
    except (StopIteration, FileNotFoundError):
        pass
    def copy(files):
        for file in files:
            try:
                shutil.copy2(file, path)
            except shutil.SameFileError:
                pass
    copy(os.path.join(shared_file_path, f) for f in 
            ('freedict-dictionary.css', 'freedict-P5.dtd', 'INSTALL',
                'freedict-P5.rng', 'freedict-P5.xml'))
    copy(os.path.join(dir_template, f) for f in os.listdir(dir_template))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号