title: Question about python string algorithm while using string to load a txt.file
body: <p><img src="https://i.stack.imgur.com/eqs6J.png" alt="The difference between code 1 and code 2 " /></p>
  <p>I am a Python novice.</p>
  <p>I know the &quot;line.rstrip()&quot; would print extra space between each line while I using a for loop to open a txt file. But the&quot; line = line.rstrip() &quot; doesn't.
  However,I just don't understand the logic behind this difference.  Why line.strip() could print extra space? Could someone tell me the logic behind this difference?</p>