Home >Backend Development >Python Tutorial >python iterate over longest word in output list

python iterate over longest word in output list

王林
王林Original
2020-05-10 09:35:3610461browse

python iterate over longest word in output list

python traverses the longest word in the output list

Specific code:

word_len_list = [len(word) for word in list]
max_word_len = max(word_len_list)
for word in list:
    if len(word) == max_word_len:
            #print(word)
        list = []

Recommended tutorial:python tutorial

The above is the detailed content of python iterate over longest word in output list. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn