python " />

扫描二维码下载沐宇APP

沐宇

微信扫码使用沐宇小程序

沐宇

python如何输出对应的月份

扬州沐宇科技
2024-04-09 16:41:36
python

在Python中,可以使用calendar模块来输出对应的月份。以下是一个示例代码:

import calendar

# 输入年份和月份
year = int(input("请输入年份:"))
month = int(input("请输入月份:"))

# 输出对应的月历
cal = calendar.month(year, month)
print(cal)

运行以上代码,用户输入年份和月份后,程序将输出对应的月历信息。

扫码添加客服微信