编写日历程序时出现错误:类型错误:'int'对象不可调用



我编写了一个简单的日历程序,它将显示所需月份的日历,但遇到类似的错误?此处为完全错误Traceback (most recent call last): File "D:Pythoncalendar.py", line 1, in <module> import calendar File "D:Pythoncalendar.py", line 4, in <module> print(calendar.month(year , month )) TypeError: 'int' object is not callable这是我的代码

import calendar
year = int(input('Enter your year:'))
month = int(input('Enter your month:'))
print(calendar.month(year , month ))

你能帮帮我吗?!

重命名它试图调用calender的月份变量,然后将该月份作为输入

inp_year = int(input('Enter your year:'))
inp_month = int(input('Enter your month:'))
print(calendar.month(inp_year , inp_month ))

相关内容

最新更新