最後更新: 2020-12-11
eventcal
http://code.google.com/p/eventcal/wiki/EventCal
Usage
[1]
import calendar myCal = calendar.HTMLCalendar(calendar.SUNDAY) print myCal.formatmonth(2009, 7)
[2]
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)