[Tutor] Calendar Module

Shuai Jiang marshall.jiang at gmail.com
Tue May 23 03:09:01 CEST 2006


Hello,
I just got Python In a Nutshell and decided to play around with the time
section. While playing with the calendar module, I encountered a problem:

>>> import calendar
>>> calendar.calendar(2006)
'                                  2006\n\n      January
February                   March\nMo Tu We Th Fr Sa Su      Mo Tu We Th Fr
Sa Su      Mo Tu We Th Fr Sa Su\n                   1             1  2  3
4  5             1  2  3  4  5\n 2  3  4  5  6  7  8       6  7  8  9 10 11
12       6  7  8  9 10 11 12\n 9 10 11 12 13 14 15      13 14 15 16 17 18
19      13 14 15 16 17 18 19\n16 17 18 19 20 21 22      20 21 22 23 24 25
26      20 21 22 23 24 25 26\n23 24 25 26 27 28 29      27
28                     27 28 29 30 31\n30 31\n\n
April                      May                       June\nMo Tu We Th Fr Sa
Su      Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su\n                1
2       1  2  3  4  5  6  7                1  2  3  4\n 3  4  5  6  7  8
9       8  9 10 11 12 13 14       5  6  7  8  9 10 11\n10 11 12 13 14 15
16      15 16 17 18 19 20 21      12 13 14 15 16 17 18\n17 18 19 20 21 22
23      22 23 24 25 26 27 28      19 20 21 22 23 24 25\n24 25 26 27 28 29
30      29 30 31                  26 27 28 29 30\n\n
July                     August                  September\nMo Tu We Th Fr
Sa Su      Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa Su\n
1  2          1  2  3  4  5  6                   1  2  3\n 3  4  5  6  7  8
9       7  8  9 10 11 12 13       4  5  6  7  8  9 10\n10 11 12 13 14 15
16      14 15 16 17 18 19 20      11 12 13 14 15 16 17\n17 18 19 20 21 22
23      21 22 23 24 25 26 27      18 19 20 21 22 23 24\n24 25 26 27 28 29
30      28 29 30 31               25 26 27 28 29 30\n31\n\n
October                   November                  December\nMo Tu We Th Fr
Sa Su      Mo Tu We Th Fr Sa Su      Mo Tu We Th Fr Sa
Su\n                   1             1  2  3  4  5                   1  2
3\n 2  3  4  5  6  7  8       6  7  8  9 10 11 12       4  5  6  7  8  9
10\n 9 10 11 12 13 14 15      13 14 15 16 17 18 19      11 12 13 14 15 16
17\n16 17 18 19 20 21 22      20 21 22 23 24 25 26      18 19 20 21 22 23
24\n23 24 25 26 27 28 29      27 28 29 30               25 26 27 28 29 30
31\n30 31\n'
>>>

I can't seem to figure out how to make it look prettier
Thanks in advance

Marshall Jiang
-- 
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning.
    Rick Cook, The Wizardry Compiled
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060522/e2b5194c/attachment-0001.html 


More information about the Tutor mailing list