首頁 > 後端開發 > Python教學 > python遍歷輸出清單中最長的單字

python遍歷輸出清單中最長的單字

王林
發布: 2020-05-10 09:35:36
原創
10513 人瀏覽過

python遍歷輸出清單中最長的單字

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
最新問題
python - ubuntu16.04 lxml的報錯
來自於 1970-01-01 08:00:00
0
0
0
有辦法在PHP裡寫Python嗎?
來自於 1970-01-01 08:00:00
0
0
0
python scrapy爬蟲錯誤
來自於 1970-01-01 08:00:00
0
0
0
python相關問題求解決,有償
來自於 1970-01-01 08:00:00
0
0
0
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板