70
edits
Changes
Libhtml
,→Extending your Html objects
=== Extending your Html objects ===
The Html class overloads the typical list methods append(), extend(), "+" and "+=" to enable you to easily build up your page. All of the following examples are valid uses of Html objects . Try them in an interactive Python session and use <object>.write(although they will not necessarily produce properly structured HTML)to view the results:
Of course, if you like you can add preformatted tags:
page += '<ul><li>one</li><li>two</li></ul>'
since the object derives from list, but then you are responsible for properly closing your tags.
page += Html('<title>My Title</title>')