title: Python .strip () Does Not Remove Blank Lines
body: <p>I wanted to read in a string from a text file and remove empty or blank lines at the end of the file using .strip () but it doesn't seem to work.  However, testing inside the interactive mode works as expected.</p>
  
  <p><strong>Example of a text file called nameList:</strong></p>
  
  <pre><code>Bob 555-333-4444
  Sam 234-343-1234
  &lt;blank line&gt;
  </code></pre>
  
  <p><strong>Using interactive mode output:</strong></p>
  
  <pre><code>&gt;&gt;&gt; str = 'Bob 555-333-4444\nSam 234-343-1234\n'
  &gt;&gt;&gt; print (str)
  Bob 555-333-4444
  Sam 234-343-1234
  
  &gt;&gt;&gt; newStr = str.strip ()
  &gt;&gt;&gt; print (newStr)
  Bob 555-333-4444
  Sam 234-343-1234
  &gt;&gt;&gt; 
  </code></pre>
  
  <p><strong>Using an open function to read the text file:</strong></p>
  
  <pre><code>list = []
  
  def readStr ():
  
          f = open ('nameList.txt', 'r')
  
          for line in f:
                  row = line.strip ()
                  print (row)
  
          f.close ()
  </code></pre>
  
  <p><strong>Output from the readStr () function:</strong></p>
  
  <pre><code>&gt;&gt;&gt; readStr ()
  Bob 555-333-4444
  Sam 234-343-1234
  
  &gt;&gt;&gt; 
  </code></pre>
  
  <p>Does it have something to do with the "open/read" function?</p>