How to get top of keys from dict by values?
<p>I have dictionary:</p>

<pre><code>{ "key1" : 1, "key2" : 2, ...., "key100" : 100 }
</code></pre>

<p>I want to get list top5 keys by sort values from this dictionary:</p>

<pre><code>[ "key100", "key99",.. "key95" ]
</code></pre>

<p>How to do it ?</p>

<pre><code>Python 2.7.10 (default, Oct 23 2015, 19:19:21)

&gt;&gt;&gt; d = {"key1": 1, "key2": 2, "key3": 3, "key98": 98 , "key99": 99 , "key100": 100}

&gt;&gt;&gt; sorted(d, reverse=True, key=d.get)[:3]
['key100', 'key99', 'key98']
</code></pre>

python