I think I want to use pythons built in calendar module to create an HTML calendar with data. I say I think because I\'ll probably think of a better way, but right now it\'s a l
You may load html, which seems to be valid XMl into a XML tree, modify it and again output it.
e.g. this adds
to each Tue td node.
cool
import calendar
import xml.etree.ElementTree as etree
myCal = calendar.HTMLCalendar(calendar.SUNDAY)
htmlStr = myCal.formatmonth(2009, 7)
htmlStr = htmlStr.replace(" "," ")
root = etree.fromstring(htmlStr)
for elem in root.findall("*//td"):
if elem.get("class") != "tue":
continue
elem.text += "!"
br = etree.SubElement(elem, "br")
br.tail = "cool!"
print etree.tostring(root)
I do not yet know why you need to generate a HTML calendar, but there are better ways of doing that depending on needs and framework you are using.