title: Should glob.glob(...) be preferred over os.listdir(...) or the other way around?
body: <p>If I'd like to create a list of all .xls files, I usually use</p>
  
  <pre><code>rdir=r"d:\temp"
  flist=[os.path.join(rdir,fil) for fil in os.listdir(rdir) if fil.endswith(".xls")]
  print flist
  </code></pre>
  
  <p>However, I recently saw an alternative to this, which is</p>
  
  <pre><code>rdir=r"d:\temp"
  import glob
  flist=glob.glob(os.path.join(rdir,"*.xls"))
  print flist
  </code></pre>
  
  <p>Which of these two methods is to be preferred and why? Or are they considered equally (un)sound?</p>