python遍历输出列表中最长的单词

王林
王林 原创
2020-05-10 09:35:36 9240浏览

python遍历输出列表中最长的单词

具体代码:

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 = []

推荐教程:python教程

以上就是python遍历输出列表中最长的单词的详细内容,更多请关注php中文网其它相关文章!

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。