划重点:openpyxl只支持「.xlsx」类型的格式。所以对于Excel2003版「.xls」格式是不支持的。
每个工作簿可以包含多个表,又称为工作表(sheet)。...import calendar
# 设置每周的起始日期码,为星期天
calendar.setfirstweekday(firstweekday=6)
# 返回2019年年历
print(calendar.calendar...15, 16, 17, 18, 19], [20, 21, 22, 23, 24, 25, 26], [27, 28, 29, 30, 31, 0, 0]]
与上图里1月份信息比较下,你会发现多了几个数字...from openpyxl.drawing.image import Image
import openpyxl
import calendar
# 设置第一天为星期天
calendar.setfirstweekday...sheet.cell(row=3, column=1).value = '2019年'
sheet.cell(row=4, column=1).value = str(i) + '月'
# 设置年份及月份文本属性