1. Computing

How To Create A HTML Calendar In Python Dynamically

From , former About.com Guide

7 of 10

Getting the Calendar Data

Now we need to create the actual calendar. To get the actual calendar data, we need the calendar module's monthcalendar() method. This method takes two arguments: the year and the month of the desired calendar (both in integer form). It returns a list which contains lists of the dates of the month by week. So if we count the number of items in the returned value, we have the number of weeks in the given month.

 month = calendar.monthcalendar(current_yr, current_no) 
 nweeks = len(month) 

  1. About.com
  2. Computing
  3. Python
  4. Web Development
  5. Python and HTML - HTML Calendars in Python - Getting the Calendar Data

©2013 About.com. All rights reserved.