MonthDayCnt는 calendar 모듈에 이미 들어있습니다.

>>> import calendar
>>> MonthDayCnt3 = lambda year, month: calendar.monthrange(year, month)[1]
>>> MonthDayCnt3(2000, 2)
29
>>> print calendar.month(2000, 2)
February 2000
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
>>>

 

출처 : http://bbs.python.or.kr/viewtopic.php?t=14603

 

'programming > python' 카테고리의 다른 글

파이썬 스타일 지도서  (0) 2004.01.27
[Sample] 베타뉴스 겔러리 그림 긁어 모으기  (0) 2004.01.27
파이썬 2.3 간편 참조서  (2) 2004.01.25

+ Recent posts