title: Questions about using I/O
body: <pre><code>fp_r = open("Team_Assignment.txt", 'r')
  
  for s in fp_r:
      if "Altos" in s:
          print("%s: DF = %s, OF = %s" %(s[0:2], s[4], s[8]))
      else:
          print("%s: DF = %s, OF = %s" %(s[0:2], s[4], s[8]))
  
  while True:
      a = input("Enter names to wap: ")
      if not a:
          break
      print(a)
  
  fp_r.close()
  </code></pre>
  
  <p>I have written code like this. I know something is wrong with what I wrote, but I don't know how to fix it. </p>
  
  <p>Team_Assignment.txt is this.</p>
  
  <pre><code> Aa  8   4   Altos
   Ba  7   6   Webee
   Ca  4   7   Altos
   Da  5   5   Webee
   Ea  2   9   Altos
   Fa  9   3   Webee
   Ga  7   8   Altos
   Ha  6   4   Webee
  </code></pre>
  
  <p>From left, it is name, DF, OF, and team name.</p>
  
  <p>I want to print like this (in Shell) </p>
  
  <pre><code>**Altos** DF = 21 OF = 28
  Ann: DF = 8, OF = 4
  Pia: DF = 4, OF = 7
  Eric: DF = 2, OF = 9
  Susan: DF = 7, OF = 8
  
  **Webee** DF = 27 OF = 18
  Henry: DF = 7, OF = 6
  Tom: DF = 5, OF = 5
  Noah: DF = 9, OF = 3
  Jin: DF = 6, OF = 4
  
  Enter names to swap: Ann Herny
  
  **Altos** DF = 20 OF = 30
  Henry: DF = 7, OF = 6
  Pia: DF = 4, OF = 7
  Eric: DF = 2, OF = 9
  Susan: DF = 7, OF = 8
  
  **Webee** DF = 28 OF = 16
  Ann: DF = 8, OF = 4
  Tom: DF = 5, OF = 5
  Noah: DF = 9, OF = 3
  Jin: DF = 6, OF = 4
  
  Enter names to swap:
  </code></pre>
  
  <p>As you can see, <code>**Altos** DF = 21 OF = 28</code> and <code>**
  Webee ** DF = 27 OF = 18</code> are missing. And Altos wasn't tied to Altos or Webee to Webee. </p>