title: How to sort values of nested dictionary?
body: <p>This is my code at the moment but I have to sort the sections in alphabetical order and the id numbers in ascending order. Does anyone know where and how I can insert the .sort/.sorted function here?</p>
  <pre><code>class_lists = {}
  class_sections = {}
  
  for i in student_data:
      for j in i['enlistment']:
          if j['course code'] not in class_lists.keys():
              class_lists[j['course code']] = [{&quot;section&quot;:j['section'],'class list':[i['id']]}]
              class_sections[j['course code']] = [j['section']]
          else:
              if j['section'] in class_sections[j['course code']]:
                  index_ = class_sections[j['course code']].index(j['section'])
                  class_lists[j['course code']][index_]['class list'].append(i['id'])
              else:
                  class_lists[j['course code']].append({&quot;section&quot;:j['section'],'class list':[i['id']]})
                  class_sections[j['course code']].append(j['section'])
  </code></pre>
  <pre><code>&gt;&gt;&gt; print{class_lists}
  {'UK 60': [
      {
        'section': 'B', 
        'class list': [
             '201007', 
             '201005', 
             '211008',
         ]
       },
       {
         'section': 'A', 
         'class list': [
             '201077', 
             '201065', 
             '211088',
         ]
       }
     ]
  }
  </code></pre>