title: Open file by filename wildcard
body: <p>I have a directory of text files that all have the extension <code>.txt</code>. My goal is to print the contents of the text file. I wish to be able use the wildcard <code>*.txt</code> to specify the file name I wish to open (I'm thinking along the lines of something like <code>F:\text\*.txt</code>?), split the lines of the text file, then print the output.</p>
  
  <p>Here is an example of what I want to do, but I want to be able to change <code>somefile</code> when executing my command.</p>
  
  <pre><code>f = open('F:\text\somefile.txt', 'r')
  for line in f:
      print line,
  </code></pre>
  
  <p>I had checked out the glob module earlier, but I couldn't figure out how to actually do anything to the files.  Here is what I came up with, not working. </p>
  
  <pre><code>filepath = "F:\irc\as\*.txt"
  txt = glob.glob(filepath)
  
  lines = string.split(txt, '\n') #AttributeError: 'list' object has no attribute 'split'
  print lines
  </code></pre>