Commit d6ca053a by BellCodeEditor

save project

parent de44b778
Showing with 12 additions and 0 deletions
with open(r"c:\Users\makcoo\Desktop\新建文本文档.txt","r",encoding="utf-8") as file:
a=file.readlines()
for i in a:
data=i.split()
sum=0
for i in data[1:]:
sum+=int(i)
b=data[0]+str(sum)
print(b)
with open(r"c:\Users\makcoo\Desktop\新建文本文档.txt","w",encoding="utf-8") as file:
c=file.writelines(b)
print(c)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment