title: How to find a string from a ZIP file using Python
body: <p>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.</p>
  
  <pre><code>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)
  </code></pre>
  
  <p>However, if the string is present in a file, it is not getting detected. <code>f</code> remains an empty list.</p>