我按如下方式定义了一个类:
class Team:
Team_name = ""
Tournament_name = ""
Kick = ""
Yellow = ""
Red = ""
Ownership = ""
Precision = ""
Aerial_duels = ""
Total_rating = ""
def __init__(self, team, tourn, kick, yellow, red, own, prec, duels, tot):
self.Team_name = team
self.Tournament_name = tourn
self.Kick = kick
self.Yellow = yellow
self.Red = red
self.Ownership = own
self.Precision = prec
self.Aerial_duels = duels
self.Total_rating = tot
当我尝试像这样定义对象时:
import Team_class as TC
obj=TC.Team("test1", "test2", "test3","test4","test5","test6","test7","test8")
它给了我以下错误:" init ()需要2个位置参数,但9个被给出"但我不明白我做错了什么。提前谢谢。