I tried to use the python calendar module in version 3.5.2 with:
import calendar
yy = 2016
mm = 12
# To ask month and year from the user
# yy = int(input("Enter year: "))
# mm = int(input("Enter month: "))
display=calendar.calendar(yy,mm)
# display the calendar
print(display)
but every time I try to run it, crashes and says:
line 2, in <module>
import calendar
line 4, in <module>
cal = calendar.month(2016, 2)
AttributeError: module 'calendar' has no attribute 'month'
Conversely, I tried this in terminal (using Python 2.7), and it does what it is told...!
Just unsure why this doesn't work in one of the latest version of Python
From this answer here. You probably calling another file called calendar. Use this to find where that file is: print(calendar)
Hope this helps!
EDIT: also according to the documentation, I think that you are looking for the function monthdatescalendar(year, month)
not calendar.month()
. please read over the python3 documentation for calendar. Thanks!