Error when reading a zip file in python
I have a problem where I have to read over the zip folder and read the zip files within.
I am getting an error while reading one of the text files from the zipped folder.
with zipfile.ZipFile(file_name) as zipped:
for filenames in zipped.namelist():
if not os.path.isdir(filenames):
print(filenames)
with open(filenames,"r",encoding="utf8") as file1:
print(file1)
When I try to run this code I a getting an error that xxxx-005.txt file not found
I have the zip file in the same folder as the code.
I have tried the below approach as well
import zipfile
import os
def read_file(file_name):
docs1 = []
doc = []
with zipfile.ZipFile(file_name) as zipped:
for filenames in zipped.namelist():
if not os.path.isdir(filenames): # print(filenames) with
zipped.open(filenames) as file1: print(file1) read_file('xxxx.zip')
**It printed the below error ----NotImplementedError: compression type 9 (deflate64)---- –**