def unzip(source, out_path):
'''Unzip function.
Arguments:
source (str): path to zip file
out_path (str): path to out_file
'''
print 'Unzipping %s to %s' % (source, out_path)
if not zipfile.is_zipfile(source):
raise ValueError('%s is not a zipfile' % source)
if not path.isdir(out_path):
raise ValueError('%s is not a directory' % out_path)
with zipfile.ZipFile(source) as zf:
zf.extractall(out_path)
评论列表
文章目录