python - Convert a tuple into a dictionary -
i've looked on internet , consulted few books can't seem find example illustrates trying do. loathe ask on because feels basic question i've been banging head against wall last few hours here goes:
how turn this:
item = ((100,may),(160,june),(300,july),(140,august))
into this:
{ item:[ { value:100, label:'may' }, { value:160, label:'june' }, { value:300, label:'july' }, { value:140, label:'august' } ] }
{'item': [dict(value=value, label=label) value, label in item]}
Comments
Post a Comment