Skip to main content
 首页 » 编程设计

python之如何在 Python 中使用日历类

2024年10月24日7artech

我是编程新手。当我在 IDLE3 shell 中输入以下代码时,它工作正常。当我保存它并将其作为模块运行或通过终端运行时,它返回以下错误:

File "/home/pi/Python_Programs/calendar.py", line 4, in calendar.prmonth(2016, i) AttributeError: 'module' object has no attribute 'prmonth'

这是我的代码:

import calendar 
 
for i in range(1, 13): 
    calendar.prmonth(2016, i) 

请告诉我我做错了什么?