title: Stripping Commas and Periods
body: <p>I am currently trying to input a text file, separate each word and organize them into a list.</p>
  
  <p>The current problem I'm having is getting rid of commas and periods from the text file.</p>
  
  <p>My code is below:</p>
  
  <pre><code>#Process a '*.txt' file.
  def Process():
      name = input("What is the name of the file you would like to read from? ")
  
      file = open( name , "r" )
      text = [word for line in file for word in line.lower().split()]
      word = word.replace(",", "")
      word = word.replace(".", "")
  
      print(text)
  </code></pre>
  
  <p>The output I'm currently getting is this:</p>
  
  <pre><code>['this', 'is', 'the', 'first', 'line', 'of', 'the', 'file.', 'this', 'is', 'the', 'second', 'line.']
  </code></pre>
  
  <p>As you can see, the words "file" and "line" have a period at the end of them.</p>
  
  <p>The text file I'm reading is:</p>
  
  <blockquote>
    <p>This is the first line of the file.</p>
    
    <p>This is the second line.</p>
  </blockquote>
  
  <p>Thanks in advance.</p>