import re f = open('顺丰英文.txt',encoding='utf-8') word = f.read() f.close() word2 = re.findall('[a-zA-Z]+', word) l1=len(word2[-1]) print("最后一个单词长度是: ",l1)
最后一个单词长度是: 6