1

查询一段文字 ,找出最长的单词

 

import re
with open("xx.txt","r",encoding="utf-8") as  f:
    txt =f.read()
print(txt)
c =re.split("\W",txt)
print(c)

longest =""
for i in c:

    if len(i) >len(longest):
        longest =i
print(111,longest)

  

posted @ 2019-04-25 19:31  萌哥-爱学习  阅读(345)  评论(0编辑  收藏  举报