作业一:最后一个单词的长度

  • 姓名:张竣杰
  • 学号:4201467
In [1]:
import re
f = open('作业一素材.txt', encoding='utf-8')

text = f.read()
lines = text.splitlines()
line = lines[-1]
words = line.split(' ')
word = words[-1]
word = word[0:-1]
print(len(word))
6