title: Get file paths inside a Zip archive that can be passed to utilities for processing. -- python
body: <p>Using python 3.5</p>
  
  <p>I need to find specific text that's stored in old-style, 1997-2003  windows .doc files and dump it into a csv. My constraints are:</p>
  
  <p>a) doc files are in a zipped archive: I can't write to disk/I need to work in memory</p>
  
  <p>b) I need to find specific text with regex, so the doc need to be converted to .txt</p>
  
  <p>Ideally I could read the files with zipfile, pass the data on to some doc-to-txt converter (e.g. textract), and regex on the txt. This might look like</p>
  
  <pre><code>import zipfile
  import textract
  import re
  
      with zipfile.ZipFile(zip_archive, 'r') as f:
      for name in f.namelist():
          data = f.read(name)
          txt = textract.process(data).decode('utf-8')  
          #some regex on txt
  </code></pre>
  
  <p>This of course doesn't work, because the argument for textract (and any other doc-to-txt converter) is a filepath, while "data" is bytes. Using "name" as the argument gives a <em>MissingFileError</em>, probably because zip archives don't have directory structures, just filenames simulating paths. </p>
  
  <p>Is there any way to regex through zipped doc files only in memory, without extracting the files (and therefore writing them to disk)? </p>