title: Get date from string by splitting
body: <p>I have a batch of raw text files. Each file begins with <code>Date&gt;&gt;month.day year News garbage</code>.</p>
  
  <p><code>garbage</code> is a whole lot of text I don't need, and varies in length. The words <code>Date&gt;&gt;</code> and <code>News</code> always appear in the same place and do not change.</p>
  
  <p>I want to copy <em>month day year</em> and insert this data into a CSV file, with a new line for every file in the format <em>day month year</em>.</p>
  
  <p>How do I copy month day year into separate variables?</p>
  
  <p>I tryed to split a string after a known word and before a known word. I'm familiar with string[x:y], but I basically want to change x and y from numbers into actual words (i.e. string[Date>>:News])</p>
  
  <pre><code>import re, os, sys, fnmatch, csv
  folder = raw_input('Drag and drop the folder &gt; ')
  for filename in os.listdir(folder):
  # First, avoid system files
  if filename.startswith("."):
      pass
  else:
      # Tell the script the file is in this directory and can be written
      file = open(folder+'/'+filename, "r+")
      filecontents = file.read()
      thestring = str(filecontents)
      print thestring[9:20]
  </code></pre>
  
  <p>An example text file:</p>
  
  <pre><code>Date&gt;&gt;January 2. 2012 News 122
  
  5 different news agencies have reported the story of a man washing his dog.
  </code></pre>