title: How to repeat this structure in the views.py?
body: <p>I'm new to python and am using the <a href="https://code.google.com/p/python-weather-api/" rel="nofollow">python-weather-api</a>. I'm trying to get this JSON structure into a <code>list</code> (this is the name that I know in Java, sorry if isn't).</p>
  
  <pre><code>'forecasts': [   {   'code': u'34',
                           'date': u'27 Mar 2013',
                           'day': u'Wed',
                           'high': u'9',
                           'low': u'2',
                           'text': u'Mostly Sunny'},
                       {   'code': u'28',
                           'date': u'28 Mar 2013',
                           'day': u'Thu',
                           'high': u'10',
                           'low': u'2',
                           'text': u'Mostly Cloudy'},
                       {   'code': u'30',
                           'date': u'29 Mar 2013',
                           'day': u'Fri',
                           'high': u'11',
                           'low': u'3',
                           'text': u'Partly Cloudy'},
                       {   'code': u'30',
                           'date': u'30 Mar 2013',
                           'day': u'Sat',
                           'high': u'11',
                           'low': u'3',
                           'text': u'Partly Cloudy'},
                       {   'code': u'28',
                           'date': u'31 Mar 2013',
                           'day': u'Sun',
                           'high': u'10',
                           'low': u'7',
                           'text': u'Mostly Cloudy'}],
  </code></pre>
  
  <p>To get access to the first value for example I'm doing this:</p>
  
  <pre><code>forecast = {
        'day_0': yahoo_result['forecasts'][0]['day'],
  }
  </code></pre>
  
  <p>This is what I'm doing now:</p>
  
  <pre><code>views.py
    forecast = {
            'day_0': yahoo_result['forecasts'][0]['day'],
            'text_0': yahoo_result['forecasts'][0]['text'],
            'high_0': yahoo_result['forecasts'][0]['high'],
            'low_0': yahoo_result['forecasts'][0]['low'],
  
            'day_1': yahoo_result['forecasts'][1]['day'],
            'text_1': yahoo_result['forecasts'][1]['text'],
            'high_1': yahoo_result['forecasts'][1]['high'],
            'low_1': yahoo_result['forecasts'][1]['low'],
  
            'day_2': yahoo_result['forecasts'][2]['day'],
            'text_2': yahoo_result['forecasts'][2]['text'],
            'high_2': yahoo_result['forecasts'][2]['high'],
            'low_2': yahoo_result['forecasts'][2]['low'],
  
            'day_3': yahoo_result['forecasts'][3]['day'],
            'text_3': yahoo_result['forecasts'][3]['text'],
            'high_3': yahoo_result['forecasts'][3]['high'],
            'low_3': yahoo_result['forecasts'][3]['low'],
  
            'day_4': yahoo_result['forecasts'][4]['day'],
            'text_4': yahoo_result['forecasts'][4]['text'],
            'high_4': yahoo_result['forecasts'][4]['high'],
            'low_4': yahoo_result['forecasts'][4]['low'],
  
      }
  
  return render(request, 'index.html', {'weather':weather, 'forecast': forecast})
  </code></pre>
  
  <p>And displaying the result in the HTML:</p>
  
  <pre><code>&lt;div class="col-md-9"&gt;
      &lt;ul&gt;
          &lt;li&gt; &lt;!-- start the loop right here --&gt;
              &lt;h2&gt;{{ forecast.day_0 }}&lt;/h2&gt;
              &lt;i class=" ico-cloudy text-primary"&gt;&lt;/i&gt;
              &lt;div class="statistics"&gt; low {{ forecast.low_0 }}&lt;/div&gt;
              &lt;div class="statistics"&gt; high {{ forecast.high_0 }}&lt;/div&gt;
          &lt;/li&gt;
          &lt;li&gt;
              &lt;h2&gt;{{ forecast.day_1 }}&lt;/h2&gt;
              &lt;i class=" ico-cloudy text-primary"&gt;&lt;/i&gt;
              &lt;div class="statistics"&gt; low {{ forecast.low_1 }}&lt;/div&gt;
              &lt;div class="statistics"&gt; high {{ forecast.high_1 }}&lt;/div&gt;
          &lt;/li&gt;
          &lt;li&gt;
              &lt;h2&gt;{{ forecast.day_2 }}&lt;/h2&gt;
              &lt;i class=" ico-cloudy text-primary"&gt;&lt;/i&gt;
              &lt;div class="statistics"&gt; low {{ forecast.low_2 }}&lt;/div&gt;
              &lt;div class="statistics"&gt; high {{ forecast.high_2 }}&lt;/div&gt;
          &lt;/li&gt;
          &lt;li&gt;
              &lt;h2&gt;{{ forecast.day_3 }}&lt;/h2&gt;
              &lt;i class=" ico-cloudy text-primary"&gt;&lt;/i&gt;
              &lt;div class="statistics"&gt; low {{ forecast.low_3 }}&lt;/div&gt;
              &lt;div class="statistics"&gt; high {{ forecast.high_3 }}&lt;/div&gt;
          &lt;/li&gt;
          &lt;li&gt;
              &lt;h2&gt;{{ forecast.day_4 }}&lt;/h2&gt;
              &lt;i class=" ico-cloudy text-primary"&gt;&lt;/i&gt;
              &lt;div class="statistics"&gt; low {{ forecast.low_4 }}&lt;/div&gt;
              &lt;div class="statistics"&gt; high {{ forecast.high_4 }}&lt;/div&gt;
          &lt;/li&gt;
      &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>But I would like to put this whole structure in a list to be able to loop in the HTML file after, how can I do that ?</p>