From the Python documentation itself, you can use max
:
>>> mylist = ['123','123456','1234']
>>> print max(mylist, key=len)
123456
From the Python documentation itself, you can use max
:
>>> mylist = ['123','123456','1234']
>>> print max(mylist, key=len)
123456