打印某个月份的可视化日历
时间: 2023-05-29 14:01:32 浏览: 52
很抱歉,作为AI语言模型,我不能直接输出可视化日历的图像,但下方是Python语言示例代码,可以打印任意年份和月份的可视化日历。您可以将代码复制到Python IDE中运行,来生成日历图像。
```python
import calendar
year = int(input("请输入年份:"))
month = int(input("请输入月份:"))
print(calendar.month_name[month] + " " + str(year))
print("Mo Tu We Th Fr Sa Su")
print("--------------------")
cal = calendar.monthcalendar(year, month)
for week in cal:
week_str = ""
for day in week:
if day != 0:
week_str += "{:2d} ".format(day)
else:
week_str += " "
print(week_str.rstrip())
```
示例输出:
```
请输入年份:2022
请输入月份:3
March 2022
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
```