exporters.py 文件源码

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

项目:sketch-components 作者: ibhubs 项目源码 文件源码
def write_file_to_zip_at_path(zip_path=None, archive=None, file_path='',
                              content='', encode=False):
    if zip_path:
        ensure_directories_for_path(zip_path)
        z = zipfile.ZipFile(zip_path, mode="a")
    elif archive:
        z = archive
    else:
        raise Exception('One of zip_path, archive must be provided.')
    print("Adding {} to archive ...".format(file_path))
    if encode:
        z.writestr(file_path, content.encode('utf-8'))
    else:
        z.writestr(file_path, content)
    storage.file_paths.add(file_path)
    if zip_path:
        z.close()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号