Python Generate Calendar
The following code is used to generate a calendar for a specified date:
Example (Python 3.0+)
# Filename : test.py
# author by : www.example.com
# Import the calendar module
import calendar
# Input the specified year and month
yy = int(input("Enter year:"))
mm = int(input("Enter month:"))
# Display the calendar
print(calendar.month(yy,mm))
The output of executing the above code is:
输入年份: 2015
输入月份: 6
June 2015
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
Other Extensions
Python3 Examples