目前,我正在使用下面的代码,但它给了我一个curruptzip文件。。在
url = urllib2.urlopen('http://mattfarmer.net/projects/thickbox/images/plant4.jpg')
f = StringIO()
zip = zipfile.ZipFile(f, 'w')
zip.writestr('plant4.jpg', url.read())
response = HttpResponse(f.getvalue(), content_type="application/zip")
response['Content-Disposition'] = 'attachment; filename=plant4bar.zip'
return response
你应该关闭你的压缩文件
相关问题 更多 >
编程相关推荐