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

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -