addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1linklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruserwarningyahoo

The Austin Python Meetup Message Board › HTML Generation in Python

HTML Generation in Python

Scott B
user 9882819
Austin, TX
Post #: 4
There seem to be a LOT of choices for HTML generation in python:


All I want is basic HTML generation -- NOT maintaining a website.
I have a python data structure (dictionary of dictionaries type thing), that I want to print to a single HTML page. I want a table of contents based on the top level dictionary's keys. The TOC should be hyperlinked to the body, with hyperlinks back to the TOC. That is about it.
It may be that this is so simple, I'm better off writing raw HTML from python.
Opinions? Thanks.

- Scott
A former member
Post #: 1
To add to your list of choices, a very popular option that I have used in the past is Jinja2 (http://jinja.pocoo.or...­.

You can pass a dictionary to the template engine to create a table of contents pretty easily. Once you have your template loaded it could be as easy as:

print template.render(mypages=mydictfrompython­)
Powered by mvnForum

Our Sponsors

  • Capital Factory

    Generously providing us a nice meeting space at the top of the Omni!

  • Atlassian

    Providing space, food, drinks for our May, June, and July 2015 meetups!

  • Rackspace

    Space for the Evening Coding meetups

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy