data_extractor.py 文件源码

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

项目:tensorflow_image_tutorial 作者: ybenoit 项目源码 文件源码
def maybe_download(url, data_dir, filename, expected_bytes, force=False):
        """
        Download a file if not present, and make sure it's the right size.
        """
        if force or not os.path.exists(os.path.join(data_dir, filename)):
            filename, _ = urlretrieve(url + filename, os.path.join(data_dir, filename))
        statinfo = os.stat(os.path.join(data_dir, filename))
        if statinfo.st_size == expected_bytes:
            print('Found and verified', filename)
        else:
            raise Exception(
                'Failed to verify' + filename + '. Can you get to it with a browser?')
        return filename
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号