这样为什么会报错?
class Person(object):
pass
p1 = Person()
p1.name = 'Bart'
p2 = Person()
p2.name = 'Adam'
p3 = Person()
p3.name = 'Lisa'
L1 = [p1, p2, p3]
L2 = L1.sort()
print L2[0].name
print L2[1].name
print L2[2].name
class Person(object):
pass
p1 = Person()
p1.name = 'Bart'
p2 = Person()
p2.name = 'Adam'
p3 = Person()
p3.name = 'Lisa'
L1 = [p1, p2, p3]
L2 = L1.sort()
print L2[0].name
print L2[1].name
print L2[2].name
2016-07-30
举报