나는 파이썬에서 초보자입니다. 이것은 상속을 보여주는 간단한 프로그램입니다. 오류가 무엇인지 판단하려면 수 없습니다. 도움이 필요하다 .파이썬 상속 간단한 문제
class games():
def __init__(self):
self.someattri = 100
class soccer(games):
def __init__(self):
super(soccer).__init__()
s = soccer()
print s.someattri
오류 :
Traceback (most recent call last):
File "/Users/sam/Desktop/Desktop/python/files.py", line 9, in <module>
s = soccer()
File "/Users/sam/Desktop/Desktop/python/files.py", line 7, in __init__
super(soccer).__init__()
TypeError: must be type, not classobj
'super (soccer, self) .__ init __()'이어야하며'games'는'object'를 상속해야합니다. – jonrsharpe
이것은 효과가 있습니다! 감사 –