在 return 语句中稍作调整就可以了。查看以下代码:def second_largest(numbers): first, second = 0,0 for n in numbers: if n > first: first, second = n, first elif first > n > second: second = n return None if second ==0 else secondprint(second_largest([2,2,2]))