title: Grab certain words and phrases from a text file in Python
body: <p>I have this block of code, and it goes through a text file, grabs it line by line and splits it up into separate words. This is all well and good, but within my text file, I have certain words and phrases that start with and end with '-', for example, '-foo-' or '-foo bar-'. Right now, they are being split up because of the code into '-foo' and 'bar-'. I understand why this is happening however.</p>
  
  <p>My plan would be to grab those instances that start and end with '-' , store them into a separate list, then the user changes each of those phrases into something new, put them back into the list. How do I tell it to grab a certain phrase if it is two separate words?</p>
  
  <pre><code>def madLibIt(text_file):
      listOfWords = [] #creates a word list
      for eachLine in text_file: #go through eachLine, and split it into 
          #seperate words
          listOfWords.extend(eachLine.split())
   print listOfWords
  </code></pre>