Getting NameError when calling function in constructor

前端 未结 4 731
粉色の甜心
粉色の甜心 2021-01-21 07:31

I ran the code below, by calling the function in the constructor

First --

>>> class PrintName:
...    def __init__(self, value):
...      self.         


        
4条回答
  •  醉话见心
    2021-01-21 07:36

    What you want is self.printName(self._value) in __init__, not just printName(self._value).

提交回复
热议问题