# -*- coding: utf-8 -*- """ Created on Sat Apr 22 22:51:03 2023 @author: 微澜 """
# replace with your code here
f = open('作业一素材.txt',encoding='utf-8')
txt = f.read()
f.close()
index = txt.find('\n顺丰控股股份有限公司')
txt_target = txt[:index]
lines = txt_target.split('\n')
last_line = lines[-1]
words = last_line.split(' ')
last_word = words[-1]
for i in range(1,len(last_word)):
last_character = last_word[-i]
if last_character.isalpha():
last_word = last_word[:-i+1]
break
if i == len(last_word):
last_word = words[-2]
print(last_word)
a=len(last_word)
print(a)
如果所写代码复杂,且没有良好的注释,那么请在这里补充解释。