title: split and readline in Python - list index out of range
body: <pre><code>!curl https://raw.githubusercontent.com/MicrosoftLearning/intropython/master/worl
  d_temp_mean.csv -o mean_temp.txt
  weather = open('mean_temp.txt','a+')
  weather.write('Rio de Janeiro,Brazil,30.0,18.0\n"')
  weather.seek(0)
  headings = weather.readline()
  apple = headings.split(',')
  city_temp = weather.readline()
  orange = city_temp.split(',')
  while city_temp:
      orange = city_temp.split(',')
      print (apple[2] + ' of ' + orange[1] + ' is ' + orange[2] + ' Celsius')
      city_temp = weather.readline()
  weather.close()
  </code></pre>
  
  <p>I don't understand why there is an error:</p>
  
  <blockquote>
    <p>list index out of range</p>
  </blockquote>
  
  <p>in the output. I have tried to separate the readline and split for ensuring the while loop only receive the string.</p>