File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -177,15 +177,15 @@ def testPersonListInPython():
177177 Person ("Helen" , 16 , 45.7 , 1.60 )
178178 ]
179179
180- # 使用使用operator模块根据年龄进行排序
181- print ("根据年龄进行排序后的结果:" )
180+ # 使用operator模块根据年龄、身高进行排序
182181 sortedPerons = sorted (personList , key = attrgetter ('age' ))
182+ sortedPerons1 = sorted (personList , key = attrgetter ('height' ))
183+
184+ print ("根据年龄进行排序后的结果:" )
183185 for person in sortedPerons :
184186 person .showMysef ()
185187 print ()
186-
187188 print ("根据身高进行排序后的结果:" )
188- sortedPerons1 = sorted (personList , key = attrgetter ('height' ))
189189 for person in sortedPerons1 :
190190 person .showMysef ()
191191
@@ -198,8 +198,8 @@ def testPersonListInPython():
198198
199199
200200# testTheDinner()
201- testSortPerson ()
202- # testPersonListInPython()
201+ # testSortPerson()
202+ testPersonListInPython ()
203203
204204
205205# testArray()
You can’t perform that action at this time.
0 commit comments