porter.py 文件源码

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

项目:portia2code 作者: scrapinghub 项目源码 文件源码
def write_to_archive(archive, project_name, files):
    """Write files to the project_name folder of the archive."""
    tstamp = datetime.now().timetuple()[:6]
    for filepath, contents in files:
        if filepath is None or contents in (None, 'null'):
            log.debug('Skipping file "%s" with contents "%r"', filepath,
                      contents)
            continue
        filepath = join(project_name, filepath)
        fileinfo = zipfile.ZipInfo(filepath, tstamp)
        fileinfo.external_attr = 0o666 << 16
        archive.writestr(fileinfo, contents, zipfile.ZIP_DEFLATED)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号