title: Python glob multiple extensions
body: <p>Hi I need to create file which contain image path in following format</p>
  
  <pre><code>/var/sample/55/cam.png;55
  /var/sample/55/desktop.png;55
  /var/sample/44/92x92.png;44
  /var/sample/44/full.png;44
  </code></pre>
  
  <p>I am using the following python script for doing this,</p>
  
  <pre><code>BASE_PATH=sys.argv[1]
  SEPARATOR=";"
  f = open('path.csv', 'w')
  
  for dirname, dirnames, filenames in os.walk(BASE_PATH):
      for subdirname in dirnames:
          subject_path = os.path.join(dirname, subdirname)
      list = glob.glob(subject_path+'/*.png')
          for filename in list:
              abs_path = "%s" % (filename)
              print "%s%s%s" % (abs_path, SEPARATOR, subdirname)
      print &gt;&gt;f, "%s%s%s" % (abs_path, SEPARATOR, subdirname)
  f.close()
  </code></pre>
  
  <p>But the above code will list only <code>.png</code> extension now, I need to include <code>.jpg,.jpeg</code> etc.. How can I edit the above code to achieve it. </p>
  
  <p>I have already found the answer <a href="https://stackoverflow.com/questions/4568580/python-glob-multiple-filetypes">here</a> but not able to understand how to apply here. </p>
  
  <p>Thanks,<br>
  Haris</p>