Python - Date and Time: AttributeError: 'module' object has no attribute 'month'

后端 未结 5 1133
醉话见心
醉话见心 2021-01-20 21:41

This is my calendar code in Python and I have saved it to my folder as calendar.py.

import calendar
a = calendar.month(2016, 3)
print (a)
print          


        
5条回答
  •  旧巷少年郎
    2021-01-20 22:29

    You might have given your file name as calendar.py. This is imported instead of the module in the standard library.

    Solution: Rename the file. Also, make sure to delete "calendar.pyc" file located in the same path where you are running the script.

    As a check, do the following to locate your module import calendar print(calendar)

提交回复
热议问题