title: Python list assignment index out of range
body: <p>I just can't understand why my list is out of range.</p>
  
  <p>I've been stuck on this problem forever now and can't wrap my head around what the problem might be.</p>
  
  <p>Obviously I'm new into programming.</p>
  
  <pre><code>def list(self,filename):
      with open(filename, "r") as listTeams:
          teamCount = 0
          indexList = []
          unsortedList = []
          lines = listTeams.readlines()
  
          for line in open(filename):
              teamCount += 1
  
          listTeams.seek(0)
  
          for i in range(0, teamCount):
              tempStr = listTeams.readlines(i)
              tempStr = "".join(tempStr)
              indexList = tempStr.split(" ")
              for i in range(0,i):
                  print(i)
                  unsortedList[i] = Team(indexList[0], indexList[1], indexList[2], indexList[3], indexList[4], indexList[5], indexList[6])
                  print(unsortedList[i])
      return
  </code></pre>
  
  <p>I get this error message:</p>
  
  <pre><code>unsortedList[i] = Team(indexList[0], indexList[1], indexList[2], indexList[3], indexList[4], indexList[5], indexList[6])
  IndexError: list index out of range
  </code></pre>