Commit 85535f2a by BellCodeEditor

auto save

parent a04b33dd
Showing with 9 additions and 2 deletions
with open(r'c:\Users\编程电脑1\Desktop\新建文本文档.txt','r',encoding='utf-8') as file: with open(r'c:\Users\编程电脑1\Desktop\新建文本文档.txt','r',encoding='utf-8') as file:
a=file.readlines() a=file.readlines()
new_sum=[]
for i in a: for i in a:
print(i) data=i.split()
\ No newline at end of file sum=0
for x in data[1:]:
sum=sum+int(x)
y=data[0]+str(sum)+'\n'
new_sum.append(y)
with open(r'c:\Users\编程电脑1\Desktop\新建文本文档.txt','a',encoding='utf-8') as file:
file.writelines(new_sum)
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