Python - Populate a dictionary with list items -
if create dictionary
in fashion:
output = {'playlist':{}}
having list
this:
tracks = [u'no surprises', u'oceans', u'up in flames']
and with
count = 0
i populate key
playlist
tracks
items
keys
0 value
, this:
output = {'playlist':{ 'no surprises': 0, 'oceans': 0, 'up in flames': 0}}
how do that?
output = {'playlist':{track: count track in tracks}}
Comments
Post a Comment