属性错误:'tuple'对象没有属性'weight'

2024-04-26 11:33:19 发布

您现在位置:Python中文网/ 问答频道 /正文

class Apple:
    def __init__( self,w,c):
        self.weight=w
        self.color=c
        print("utworzono!")



ap1=(280,"red")
print(ap1)
print(ap1.weight)

我不知道我做错了什么。我在这里写的东西都是从书上写的。在


Tags: selfappleinitdefredclasscolorprint