Object is not callable error

2019-08-21 09:38发布

问题:

import math

class Word:
    '''A class that represents word'''

def __init__(self, word):
    self._word = word

def __str__(self):
    return self._word


c = word("Hello")
print (c())

This results with "builtins.TypeError: 'Word' object is not callable"

How can I check the value of c using print(c())?

标签: class object