Json, urlib2 and pprint
Question: I have the following exercise:

_Use the[json](http://docs.python.org/library/json.html) module. First use
[urllib2](http://docs.python.org/howto/urllib2.html) to download this file,
then load the json as a python object and use **pprint** to make it look good
when written to the terminal._

Now until now I've only worked with standard Python things (such as the
codeacademy course and things such as lists).

What I understand is that I have to import urllib2 and apparently import json
in some other way and use pprint...???

This is what I have done, but not sure if I got it right...

    
    
    import urllib2
    response = urllib2.urlopen('https://dl.dropboxusercontent.com/u/153071/test.json')
    html = response.read()
    import json
    import pprint
    pp = pprint.PrettyPrinter(indent=4)
    pp.pprint(c) #Just printing a list from earlier in the file, not sure what to print...
    


Answer: You don't need to import `pprint`. You can specify indentation using the json
module itself

    
    
    import urllib2                                                                       
    import json                                                                          
    response = urllib2.urlopen('https://dl.dropboxusercontent.com/u/153071/test.json')   
    content_dict = json.loads(response.read())                                           
    print json.dumps(content_dict, indent=4)
    

