calendar.setfirstweekday(numble)
print(calendar.firstweekday())
#二者在下面的代码中依然能起作用
import calendar
print(calendar.month(2020,10,w=0,l=0))
#还可以写为:
print(calendar.month(theyear=2020,themonth=10,w=0,l=0))
#w表示个位数日期之间的距离
#l表示(Mon Tue Wed Thu Fri Sat Sun)相对应的每一组数之间的间隔
输出为:
October 2020
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 30 31
October 2020
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 30 31
Process finished with exit code 0
import calendar
print(calendar.monthcalendar(2020,4))
#以列表的形式输出一个月,空值用0表示