I am trying to read a string from a ZIP file which contains n number of files. If the string is present in the file, that file has to be moved to a specific location.
import zipfile,os,shutil
f = []
files = 'Contains given substring'
os.chdir(r'C:\Users\Vishali\Desktop\PY\POC')
archive = zipfile.ZipFile('PY.zip')
print(archive.namelist())
for n in archive.namelist():
    print(n)
    f1 = archive.open(n,'r')
    re = f1.readlines()
    print(files)
    print(re)
    if files in re:
        shutil.copy(n,r'C:\Users\Vishali\Desktop\PY\s')
        f.append(f1)
print(f)
However, if the string is present in a file, it is not getting detected. f remains an empty list.
 
     
    