Typeerror: __init__() Takes 1 Positional Argument But 4 Were Given
class voting(): number = 0 name = '' surfer = '' def __init__(self, num, na, surf): self.number = num self.name = na self.surfer = surf
Solution 1:
If I got it well, you want the class judge to inherit from the class voting. To specify this you should do it like this :
classvoting():
number = 0
name = ""
surfer = ""def__init__(self, num, na, surf):
self.number = num
self.name = na
self.surfer = surf
defsave_surfer(self):
file = open("Surfer_list.txt", "a")
file.write("%07s%16s%16s\n" % (self.number, self.name, self.surfer))
file.close()
classjudge(voting):
def__init__(self, num, na, surf):
voting.__init__(self, num, na, surf)
defsave(self):
file = open("Surfer_list.txt", "a")
file.write("%07s%16s%16s\n" % (self.number * 11, self.name, self.surfer))
file.close()
Doc about inheritance in python
Post a Comment for "Typeerror: __init__() Takes 1 Positional Argument But 4 Were Given"