python iter on a 28dic key 29 value

Solutions on MaxInterview for python iter on a 28dic key 29 value by the best coders in the world

showing results for - "python iter on a 28dic key 29 value"
Laetitia
29 Oct 2016
1items = d.items()
2print(items)
3print(type(items))
4# dict_items([('key1', 1), ('key2', 2), ('key3', 3)])
5# <class 'dict_items'>
6
7i_list = list(d.items())
8print(i_list)
9print(type(i_list))
10# [('key1', 1), ('key2', 2), ('key3', 3)]
11# <class 'list'>
12
13print(i_list[0])
14print(type(i_list[0]))
15# ('key1', 1)
16# <class 'tuple'>
17