python-small-examples

@author jackzhenguo
@desc 
@date 2019/4/6

66 求更长的列表

def max_length(*lst):
    return max(*lst, key=lambda v: len(v))


r = max_length([1, 2, 3], [4, 5, 6, 7], [8])
print(f'更长的列表是{r}')  # [4, 5, 6, 7]

r = max_length([1, 2, 3], [4, 5, 6, 7], [8, 9])
print(f'更长的列表是{r}')  # [4, 5, 6, 7]
[上一个例子](/python-small-examples/md/65.html) [下一个例子](/python-small-examples/md/67.html)