Python错误“TypeError:'int' object is not callable”

5

这是我的代码:

import time
a = time.daylight()
print(a)

这会导致:

TypeError: 'int' object is not callable.

问题是什么?


1
只需删除括号。 - stark
你可以使用print(type(time.daylight))来查看属性的类型。如果它是一个函数,那么你可以用括号()调用它。 - blakev
可能是重复的问题:TypeError: 'int' object is not callable - Cees Timmerman
1个回答

6

time.daylight是一个数字,不要尝试在末尾加括号来调用它。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接