[Tutor] Cal command in python...

Kent Johnson kent37 at tds.net
Thu Nov 2 13:30:47 CET 2006


Asrarahmed Kadri wrote:
> 
>  
> Folks,
>  
> Does anybody have an idea of the logic used in cal command... I want to 
> know the algorithm so that I can implement in Python.

See the calendar module. Source code in the library if you want to see 
how it is done.

In [1]: import calendar

In [2]: calendar.prmonth(2006, 10)
     October 2006
Mo Tu We Th Fr Sa Su
                    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 31

Kent



More information about the Tutor mailing list