title: After split(), list encountered IndexError: list index out of range
body: <p>I'm trying to read a datafile and get the data.</p>
  
  <p>My Python code:</p>
  
  <pre><code>f = open('datafile', 'r')
  for line in f.readlines():
      line = line.strip()
      print line
  
      dataList = line.split('-')
  
      print dataList
      print len(dataList)
      print dataList[0]
  
      # print dataList[1] # IndexError: list index out of range
      # print dataList[2] # IndexError: list index out of range
      # print dataList[3] # IndexError: list index out of range
  </code></pre>
  
  <p>For example, taking one line in that file, the code has following output:</p>
  
  <pre><code>0A-02-01-04
  ['0A', '02', '01', '02']
  4
  0A
  </code></pre>
  
  <p>But accessing other member data gives out of range error</p>