class student:
def __init__(self, name, age, mark):
self.name = name
self.age = age
self.mark = mark
std1 = student("name1", 14, 45)
std2 = student("name2", 13, 90)
std3 = student("name3", 14, 70)
std4 = student("name4", 14, 80)
std5 = student("name5", 13, 75)
listofStds = ["std1", "std2", "std3", "std4", "std5"]
for x in sorted(listofStds,key=lambda x: x.mark):
print x
请帮忙。我是 python 初学者,我正在使用类尝试这个简单的排序程序,但我不断收到以下错误
AttributeError:“str”对象没有属性“mark”