title: Trying to use insertion sort to sort a list of dictionaries with the value of its child (python)
body: <p>My dictionaries are from a database but for this example imagine i have two dictionairies</p>
  <pre><code>    dictionary1 = {
          &quot;score&quot;: str(percentageScore),       #totalScore
          &quot;date&quot;: str(today),      #today
          &quot;title&quot;: str(title),   #title
          &quot;timestamp&quot;: str(timestamp)  #timestamp to display results in order
      }
  </code></pre>
  <p>The timestamp is an integer and i would like to use it to sort a python list containing multiple dictionaries like this, in descending order based on the timestamp integer.</p>
  <p>I have tried to do this with:</p>
  <pre><code>sortedScores = [dictionary1, dictionary2, dictionary3]
  
              for i in range(1, len(sortedScores)):
                  sortKey = sortedScores[i['timestamp']]
                  j = (i - 1)
                  while (j &lt;= 0) and (sortKey &lt; (sortedScores[j])['timestamp']):
                      sortedScores[j+1] = sortedScores[j]
                      j -= 1
                  sortedScores[j+1] = sortKey
  </code></pre>
  <p>However i am currently getting the error</p>
  <blockquote>
  <p>TypeError: 'int' object is not subscriptable</p>
  </blockquote>