标签:pre def print func person __init__ turn return int
class Person:
def __init__(self,age):
self.age = age
a = Person(5)
s = Person(1)
d = Person(2)
z = Person(7)
x = Person(88)
c = Person(55)
v = Person(3)
b = Person(6)
obj_list = [a,s,d,z,x,c,v,b]
def func(obj):
return obj.age
k = max(obj_list,key = func)
print(k.age)
f = max(obj_list,key = lambda obj : obj.age)
print(f.age)
标签:pre def print func person __init__ turn return int
原文地址:https://www.cnblogs.com/liujie12/p/12311112.html