Build unordered list in HTML from a python list

Nico Grubert nicogrubert at yahoo.de
Wed Jun 30 07:15:30 EDT 2010


> Use a stack?
> 
> Whenever you start a new list, push the corresponding closing tag onto
> a stack.  Whenever your "indent level" decreases, pop the stack and
> write out the closing tag you get.
> 
> It's straightforward to use a python list as a stack.

Thanks for the tip, Kushal.
Do you have a short code example for me?

Regards
Nico



More information about the Python-list mailing list