What's the best data structure for output that's processed by Python?
Question: My client currently has text files that are output as tab delimited data and
with HTML table chunks. Their system takes these HTML table chunks and sticks
them in an HTML template file. I was looking at outputting the data as json or
xml, and separating out the views functions. I've done this a bunch with
front-end processes. The difference for me here is that I'm processing the
data on the server-side and outputting simple HTML, instead of populating it
via Javascript. My tendency is towards json, since I already am outputting a
few other files in this system that way.


Answer: JSON is probably your best bet. Python has an excellent [JSON
library](https://docs.python.org/3/library/json.html) which can provide native
Python objects with just one function call. From the docs:

    
    
    >>> import json
    >>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]')
    ['foo', {'bar': ['baz', None, 1.0, 2]}]
    

Just save the output of `json.loads` into a variable and you're off and
running.

