Created
February 16, 2013 20:46
-
-
Save spidaman/4968669 to your computer and use it in GitHub Desktop.
python dictionary from a pair of lists
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
links = ['link1', 'link2','link3'] | |
images = ['img1','img2','img3'] | |
json.dumps(dict(zip(links,images))) | |
# '{"link1": "img1", "link3": "img3", "link2": "img2"}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment