import calendar
print calendar.calendar(2017)
import calendar
print calendar.month(2017, 6)
import calendar
print calendar.calendar(2017)
import calendar
print calendar.monthrange(2017, 7)
import calendar
print calendar.monthcalendar(2017, 7)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import calendar
while True:
try:
myinput = raw_input("please input year or month:")
input_list = myinput.split(' ')
if len(input_list)==1:
year = int(input_list[0])
cal = calendar.calendar(year)
print cal
elif len(input_list)==2:
year = int(input_list[0])
month = int(input_list[1])
cal = calendar.month(year,month)
print cal
else:
print "Your input is not right!"
except (ValueError, TypeError):
print "Your input is not right!"
网友评论