title: Python Dict Grouping by Date on Key
body: <p>I have a dict and its keys are dates, its items are some numbers and sum of the numbers with <code>Total</code> as shown below. I want to group the keys by year with their sum of <code>Total</code> value. I know how to do it if I use fixed dict. But I will always write different changeable dates. My example list is;</p>
  
  <pre><code>{
          "15-12-2017" : {
            "1" : "abc",
            "2" : "def",
            "Total" : "2"
          },
          "16-12-2017" : {
            "1" : "ghi",
            "2" : "jkl",
            "3" : "mno",
            "Total" : "3"
          }
          "17-12-2017" : {
            "1" : "ghi",
            "2" : "jkl",
            "3" : "mno",
            "4" : "pqr",
            "Total" : "4"
          }
          "15-12-2018" : {
            "1" : "ghi",
            "2" : "jkl",
            "3" : "mno",
            "Total" : "3"
          }
          "16-12-2018" : {
            "1" : "ghi",
            "2" : "jkl",
            "Total" : "2"
          }
          "18-12-2019" : {
            "1" : "ghi",
            "2" : "jkl",
            "3" : "mno",
            "Total" : "3"
          }
  }
  </code></pre>
  
  <p>I want to get a new list like;</p>
  
  <pre><code>{"2017":9,"2018":5,"2019":3}
  </code></pre>
  
  <p>I can do only;</p>
  
  <pre><code>for key in my_list:
      if key.split('-')[2] == '2017':
          l_2017.append(key)
  </code></pre>
  
  <p>But as I said before, I will insert many changeable dates. How can I cluster them like this format?</p>