我想访问SeqList的成员,但是通过我已知的方法只能得到它的地址
class SequenceList:
def __init__(self):
self.SeqList = []
def appendElement(self, x):
self.SeqList.append(x)
print(str(self.SeqList))
class Student:
def init(self, n, a, s):
self.name = n
self.age = a
self.scores = s
mySeq = SequenceList()
stu1 = Student("王小红", 20, (88, 78, 98))
stu2 = Student("张楠", 21, (80, 78, 90))
stu3 = Student("李大白", 19, (88, 78, 90))
mySeq.appendElement(stu1)
mySeq.appendElement(stu2)
mySeq.appendElement(stu3)
输出一堆地址 [<__main__.Student object at 0x000002938DBC6940>]
试过很多网上看的方法,但是没有类似的题目,还是不知道该怎么办
我想通过SequenceList类来比较后面的成绩,求和,求平均值等等,而不是在Student类中