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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
import time
year = time.strftime('%Y', time.localtime(time.time())) year = (int)(year) month = time.strftime('%m', time.localtime(time.time())) day = time.strftime('%d', time.localtime(time.time())) day = (int)(day) week = time.strftime('%w', time.localtime(time.time()))
week = (int)(week) for i in range(0, day - 1): week = week - 1 if week == -1: week = 6
if year % 4 == 0 and year % 400 != 0 or year % 400 == 0 : isLeap = True else : isLeap = False
if month == '01' or month == '03' or month == '05' or month == '07' or month == '08' or month == '10' or month == '12' : allDay = 31 elif month == '02' and isLeap : allDay = 29 elif month == '02' and not isLeap : allDay = 28 else : allDay = 30
print ' ' + str(year) + ' ' + str(month) print '' print 'Sun Mon Tue Wed Thu Fri Sat'
for i in range(week) : print ' ',
for i in range(1, allDay + 1) : x = str(i) print '%-4s' % x, week = week + 1 if week == 7 : week = 0 print
raw_input()
|