Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (16.4k points)

When I tried executing the below code:

import calendar

cal = calendar.month(2014, 7)

print(cal)

When I execute the above code, I get an error saying:

AttributeError: 'module' object has no attribute 'month'

Anyone, kindly help me.

1 Answer

0 votes
by (26.4k points)

More than likely you have a local document calendar.py that is imported rather than the module in the standard library. 

Discover where by printing the module:

import calendar

print(calendar)

Now just rename that document, it is actually masking the standard library version.

Join the python online course fast, to learn python concepts in detail and get certified.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...