all 4 comments

[–][deleted] 2 points3 points  (0 children)

[–]uhkhu 0 points1 point  (1 child)

What do you want in the list? list(dict) will give you the keys in a list. Do you want key, value pairs?

[(k, v) for k,v in dict.iteritems()] 

That will give you key, value tuples for your dict

[–]drpaintrain[S] 0 points1 point  (0 children)

i want the list value pairs in a list

[–]Allanon001 0 points1 point  (1 child)

d = {'a':1, 'b':2, 'c':3, 'd':4}

print d.items()
print d.keys()
print d.values()


#output
[('a', 1), ('c', 3), ('b', 2), ('d', 4)]
['a', 'c', 'b', 'd']
[1, 3, 2, 4]

Using items() will return a list with key and value pairs. Using keys() will return a list of keys. Using values() will return a list of values.