take first n key value pair in dictionary python code example
Example: get n items from dictionary python
list(islice(d.iteritems(), n))
'Update for Python 3.6
list(islice(d.items(), n))
list(islice(d.iteritems(), n))
'Update for Python 3.6
list(islice(d.items(), n))