Easy Tutorial
❮ Python Ascii Character Python Os Dup ❯

Python Generate Calendar

Python3 Examples

The following code is used to generate a calendar for a specified date:

Example (Python 3.0+)

# Filename : test.py
# author by : www.tutorialpro.org

# Import calendar module
import calendar

# Input specified year and month
yy = int(input("Enter year: "))
mm = int(input("Enter month: "))

# Display calendar
print(calendar.month(yy, mm))

Executing the above code produces the following result:

Enter year: 2015
Enter month: 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

Python3 Examples

❮ Python Ascii Character Python Os Dup ❯