title: Find files in a directory with a partial string match
body: <p>I have a directory which contains the following files:</p>
  
  <pre><code>apple1.json.gz
  apple2.json.gz
  banana1.json.gz
  melon1.json.gz
  melon2.json.gz
  </code></pre>
  
  <p>I wish to find all of the <code>apple</code>, <code>banana</code> and <code>melon</code> file types.</p>
  
  <p>From this <a href="https://stackoverflow.com/questions/3964681/find-all-files-in-directory-with-extension-txt-in-python">SO answer</a> I know that I can find by file type by:</p>
  
  <pre><code>import glob, os
  os.chdir("/mydir")
  for file in glob.glob("*.json.gz"):
      print(file)
  </code></pre>
  
  <p>However, in my case I can't match by file name or file type. Rather it is a partial file name match (all <code>apple</code>'s and so on)</p>
  
  <p>In this <a href="https://stackoverflow.com/questions/16492775/glob-pattern-matching-the-first-part-of-a-file-name">SO question</a>, this solution was proposed:</p>
  
  <pre><code>[in] for file in glob.glob('/path/apple*.json.gz'):
      print file
  </code></pre>
  
  <p>However, this returns zero</p>
  
  <pre><code>[out]
       0
  </code></pre>