执行以下代码时,我在第9行收到以下错误(在第二行的if语句内)。
AttributeError模块'calendar'没有属性'FIRDAY'
print(calendar.FRIDAY)
print("Team meetings will be on: ")
for m in range(1, 13):
cal = calendar.monthcalendar(2018, m)
weekone = cal[0]
weektwo = cal[1]
if weekone[calendar.FRIDAY] != 0:
meetday = weekone[calendar.FIRDAY]
else:
meetday = weektwo[calendar.FRIDAY]
print("%10s %2d" % (calendar.month_name[m], meetday))
但是第一行上的打印语句执行没有任何问题。有人帮忙吗?
注意:PATH和脚本目录中都没有名为calendar.py的文件。
答案 0 :(得分:1)
FIRDAY
不是单词,应该是Friday
更正的部分:
if weekone[calendar.FRIDAY] != 0:
meetday = weekone[calendar.FRIDAY]