title: python dictionary error AttributeError: 'list' object has no attribute 'item'
body: <p>I am getting an unexpected error. I realize that there are posts with similar errors but either could not understand the answer or could not relate it to my case (dictionary).</p>
  
  <p>I am trying to calculate a similarity score for each line of an input file and at every iteration (i.e for each line of input file) store the top 20 values of the score in a dictionary.</p>
  
  <p>Following is my code:</p>
  
  <pre><code>result={}
  //code for computation of score for each line of an input file
  
  if (len(result)&lt;20):
      result[str(line)]=score
  else:
      if(len(result)==20):
          result = sorted(result.iteritems(), key=operator.itemgetter(1))
          if(result.item()[19].value()&lt;score):
              result.item()[19][str(line)]=score
  </code></pre>
  
  <p>The error is:</p>
  
  <pre><code>File "retrieve.py", line 45, in &lt;module&gt;
  if(result.item()[19].value()&lt;score):
  AttributeError: 'list' object has no attribute 'item'
  </code></pre>