Created
October 18, 2014 17:45
-
-
Save mvallebr/8a715d7ad457debb748b to your computer and use it in GitHub Desktop.
Example showing how to read dict marshalled using str(dict) and print json
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
''' | |
Created on 18/10/2014 | |
@author: mvalle | |
''' | |
from urllib2 import urlopen | |
import json | |
if __name__ == '__main__': | |
f = urlopen("https://gist.githubusercontent.com/anonymous/acbd70c0616e4225764c/raw/41e9b49faf122d346cce0b5bc12176e33874034a/gistfile1.txt") | |
try: | |
file_text = f.read() | |
finally: | |
f.close() | |
my_dict_var = eval(file_text) | |
print json.dumps(my_dict_var, indent=4) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment