calendar modules

Robin Munn rmunn at pobox.com
Wed Nov 13 13:18:26 EST 2002


Wojtek Walczak <gminick at hacker.pl> wrote:
> Dnia Wed, 13 Nov 2002 23:38:03 +0800, Geiger Ho napisa³(a):
>> well in MS Windows. When I type "calendar.month(2002,11)", it outputs a
>> string
> Yes, it outputs a string... for printing :)
> print calendar.month(2002, 11)
>     November 2002
> 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
> 

And don't forget the monthcalender() function if you wanted data instead
of output:

>>> import calendar
>>> calendar.monthcalendar(2002, 11)
[[0, 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]]

I'm sure you can think of many ways to use this...

-- 
Robin Munn <rmunn at pobox.com>
http://www.rmunn.com/
PGP key ID: 0x6AFB6838    50FF 2478 CFFB 081A 8338  54F7 845D ACFD 6AFB 6838



More information about the Python-list mailing list