纪懿玲的作业一

代码


import re
f = '作业一素材.txt'
with open(f, 'r',encoding='utf-8') as f:
    lines = f.readlines()
    last_line = lines[-3]
    goal=last_line.split(" ")
    word=goal[-1]
    goal = re.split(r'[.]', word)
    word = goal[0]
    print("所求结果为",len(word))

结果

结果截图

解释

如果所写代码复杂,且没有良好的注释,那么请在这里补充解释。