Skip to content Skip to sidebar Skip to footer

Python : Can't Solve Attributeerror - Object Has No Attribute Xxx

This is the python code that causes me problems : # -*- coding: utf-8 -*- class ObjectType2 (object): def __init__ (self): self.name = '' self.value2 = 0 cl

Solution 1:

The

def__init(self):

should be

def__init__(self):
          ↑↑

Without the two trailing underscores this is just a method like any other, not a constructor.

Post a Comment for "Python : Can't Solve Attributeerror - Object Has No Attribute Xxx"