title: How to get list values inside dictionary
body: <p>I have the following dictionary</p>
  
  <pre><code>{"api": {"results": 12, "seasons": [2008, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020]}}
  </code></pre>
  
  <p>I need to extract values inside seasons key </p>
  
  <pre><code>[2008, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020]
  </code></pre>
  
  <p>and assign each list value to variable</p>
  
  <pre><code>var1 = 2008
  var2= 2010 
  etc
  </code></pre>
  
  <p>I am trying the following approach</p>
  
  <pre><code>a =  {"api": {"results": 12, "seasons": [2008, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020]}}
  for i in a["api"]["seasons"]:
      print(i)
  </code></pre>
  
  <p>After running above script i get an error </p>
  
  <pre><code>TypeError: string indices must be integers
  </code></pre>
  
  <p>I also tried to extract values without specifying ["api"]["seasons"]</p>
  
  <pre><code>for i in a:
      print(i)
  </code></pre>
  
  <p>But output of this expression is only one digit per row. I understand that when inside list inside dictionary it have another rules for looping it. Can anyone guide me what i should read to better understand how i should loop in such cases </p>