Wednesday, 14 August 2013

python list to dict with multiple value for each key

python list to dict with multiple value for each key

Can list be used to create dictionaries as following:
mylist = ['a',1,2,'b',3,4,'c',5,6]
mydict = {a:(1,2),b:(3,4),c:(5,6)}

No comments:

Post a Comment