class Xxx():
def _init_(self):
"""屬性"""
self.xxxx = 0
# 實例調用xxxx屬性
x = Xxx()
print(str(x.xxxx)) # 不帶括號時調用的是這個屬性本身
print(str(x.xxxx())) # x.xxxx()帶括號時調用,帶括號後就必須要傳入需要的參數,而類創建的時候由於沒有設置默認值屬性相應形參,導致會提示is not callable(沒有調用)
class Xxx():
def _init_(self):
"""屬性"""
self.xxxx = 0
# 實例調用xxxx屬性
x = Xxx()
print(str(x.xxxx)) # 不帶括號時調用的是這個屬性本身
print(str(x.xxxx())) # x.xxxx()帶括號時調用,帶括號後就必須要傳入需要的參數,而類創建的時候由於沒有設置默認值屬性相應形參,導致會提示is not callable(沒有調用)