[Tutor] Calendar

nitin chandra nitinchandra1 at gmail.com
Tue Sep 13 07:02:34 CEST 2011


I tried it in the following way, but beyond that i am not able to go.

#!/usr/bin/env python

import os, re, sys, calendar
from datetime import datetime

    myCal = calendar.monthcalendar(2011,9)
    html += str(myCal)
    mycal = myCal[:1]
    cal1 = myCal[1:2]
    cal2 = myCal[2:3]
    cal3 = myCal[3:4]
    cal4 = myCal[4:5]

    html += str(mycal)+'<br>'
    html += str(cal1)+'<br>'
    html += str(cal2)+'<br>'
    html += str(cal3)+'<br>'
    html += str(cal4)+'<br>'
    html += "<br>"

This is the following output — which I need in the above format:

[[0, 0, 0, 1, 2, 3, 4]]
[[5, 6, 7, 8, 9, 10, 11]]
[[12, 13, 14, 15, 16, 17, 18]]
[[19, 20, 21, 22, 23, 24, 25]]
[[26, 27, 28, 29, 30, 0, 0]]

How do I proceed, or is there another way?


Thanks


More information about the Tutor mailing list