fname = '作业一素材.txt'
with open('作业一素材.txt','r',encoding='utf-8') as f:
lines = f.readlines() #读取所有行
last_line = lines[-3] #取最后一行
words=last_line.split(" ")#分割出各个单词
word=words[-1]
word = word.replace("\n", "")
word = word[0:-1]#输出最后一个单词
print(len(word))
详情请见代码