用Python打印月历,年历

>>>import calendar

>>> sep = calendar.TextCalendar(calendar.SUNDAY)
>>> sep.prmonth(2021,9)  #month
>>>print(calendar.month(2021,4))  #month
>>>print(calendar.prcal(2021))   #year
>>> for name in calendar.month_name:
	print(name)
January
February
March
April
May
June
July
August
September
October
November
December

>>> for name in calendar.day_name:
	print(name)

Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Sunday

cnliutz

计算机基础教师

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注