Answers for "How to find the longest string in sub list in Python"

3

how to find the longest string in a list in python

a_list = ["a_string", "the_longest_string", "string"]
longest_string = max(a_list, key=len)
print(longest_string)
Posted by: Guest on April-17-2021

Code answers related to "How to find the longest string in sub list in Python"

Python Answers by Framework

Browse Popular Code Answers by Language