Python Snippets

Contents:

Manipulating file handles

Use the with statement

with urlopen(json_url) as resp:
    contents = resp.read().decode()
    pprint(loads(contents))

instead of:

fh = open("file.txt", "w")
fh.read()
fh.close()

Use of JSON

JSON
JSON is The most widely spread data interchange format

The json builtin library

TODO: put some json sample