I have .zip file which contain csv data. I am reading .zip file using
<input type = "file" name = "select_file"/>
开发者_如何学JAVA
I want to decompress that .zip file and read csv data.
file_data = self.request.get('select_file')
file_str = zlib.decompress(file_data)
#file_data_list = file_str.split('\n')
#file_Reader = csv.reader(file_data_list,quoting=csv.QUOTE_NONE )
I am expecting csv data in file_str but I am getting error.
error :: Error -3 while decompressing data: incorrect header check
What I have to use?
Try making a zipfile.ZipFile object instead -- as the first argument, you need an open file-like object, so first make one out of your file_data
bytes with cStringIO.
精彩评论