Python!需要调用calenda模块中的month函数

从键盘输入年份值year和月份值mon,输出该年当月日历m

下面是一个示例代码:

import calendar

year = int(input('请输入年份:'))
mon = int(input('请输入月份:'))

# 输出日历
print(calendar.month(year, mon))

运行上面的代码,输入年份和月份,就可以输出该年该月的日历了。

如果您想自定义输出的日历格式,可以使用calendar模块的其他相关方法。您可以在Python官方文档中了解更多关于calendar模块的信息:https://docs.python.org/3/library/calendar.html