我第一次在 python 中使用日历函数这是我的代码:
import calendar
print ("The calender of year 2018 is : ")
print (calendar.calendar(2018,2,1,6))
print ("The starting day number in calendar is : ",end="")
print (calendar.firstweekday())
我得到以下输出
The calender of year 2018 is :
Traceback (most recent call last):
File "C:/Users/AAKASH PATEL/Desktop/calendar.py", line 5, in <module>
import calendar
File "C:/Users/AAKASH PATEL/Desktop\calendar.py", line 10, in <module>
print (calendar.calendar(2018,2,1,6))
TypeError: 'module' object is not callable
我该如何解决这个问题
请您参考如下方法:
将您的脚本名称从 calendar.py 重命名为 calendarScript.py
"C:/Users/AAKASH PATEL/Desktop/calendar.py"
到
"C:/Users/AAKASH PATEL/Desktop/calendarScript.py",
注意:不要将您的脚本命名为与模块相同的名称。
