title: Sort list of key value pairs in python dictionary
body: <p>How can I sort an adjacency list in python that is store as a dictionary?</p>
  
  <pre><code>Adjacency List:
  0: [(7, 0.16), (4, 0.38), (2, 0.26), (6, 0.58)]
  1: [(5, 0.32), (7, 0.19), (2, 0.36), (3, 0.29)]
  2: [(3, 0.17), (0, 0.26), (1, 0.36), (7, 0.34), (6, 0.4)]
  3: [(2, 0.17), (1, 0.29), (6, 0.52)]
  4: [(5, 0.35), (7, 0.37), (0, 0.38), (6, 0.93)]
  5: [(4, 0.35), (7, 0.28), (1, 0.32)]
  6: [(2, 0.4), (3, 0.52), (0, 0.58), (4, 0.93)]
  7: [(4, 0.37), (5, 0.28), (0, 0.16), (1, 0.19), (2, 0.34)]
  </code></pre>
  
  <p>I would like each row to be sorted by the floating point number.</p>
  
  <p>This is how the values were added but with a loop and reading from stdin rather than manually:</p>
  
  <pre><code>adjList = defaultdict(list)
  adjList[0].append((7, 0.16))
  </code></pre>
  
  <p>I understand I have to use sorted() and I've tried stuff like this:</p>
  
  <pre><code>sorted(adjList)
  </code></pre>
  
  <p>or</p>
  
  <pre><code>for i in adjList:
  sorted(adjList[i])
  </code></pre>
  
  <p>or</p>
  
  <pre><code>value for (key, value) in sorted(adjList[0])
  </code></pre>