python calendar.HTMLCalendar

前端 未结 5 1086
面向向阳花
面向向阳花 2021-02-02 04:10

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

5条回答
  •  耶瑟儿~
    2021-02-02 04:35

    You can subclass HTMLCalendar and override its methods in order to do whatever you want, like so: http://journal.uggedal.com/creating-a-flexible-monthly-calendar-in-django/

    If you refer to the documentation for HTMLCalendar (http://svn.python.org/view/python/branches/release27-maint/Lib/calendar.py?view=markup), you'll see that the formatday() method is very straightforward. Simply override it, as in the example linked above, to do whatever you'd like. So HTMLCalendar isn't so pointless after all. ;)

提交回复
热议问题