title: Order/Sort a dictionary of dictionaries by a value of the sub-dictionary
body: <p>I have a dictionary where the values are dictionaries too. I want to order the key/values of the main dictionary by a value of the value-dictionaries (in the example by date).</p>
  <p>Example:</p>
  <pre><code>a = {
      1: {'Text': 'Test1', 'Date': '2021-05-11'},
      2: {'Text': 'Test2', 'Date': '2021-12-12'},
      3: {'Text': 'Test3', 'Date': '2021-01-01'}
      }
  </code></pre>
  <p>The ordered object should look like this:</p>
  <pre><code>a = {
      3: {'Text': 'Test3', 'Date': '2021-01-01'},
      1: {'Text': 'Test1', 'Date': '2021-05-11'},
      2: {'Text': 'Test2', 'Date': '2021-12-12'}
      }
  </code></pre>
  <p>I managed to do this with a list of dictionaries:</p>
  <pre><code>a = [
      {'ID': 1, 'Text': 'Test1', 'Date': '2021-05-11'},
      {'ID': 2, 'Text': 'Test2', 'Date': '2021-12-12'},
      {'ID': 3, 'Text': 'Test3', 'Date': '2021-01-01'},
      ]
  
  a = sorted(a, key=lambda k: k['Date'])
  </code></pre>
  <p>But I cannot figure it out with a dictionary of dictionaries. Maybe someone can point me in the right direction.</p>
  <p>Thanks in advance.
  Frank</p>