Commit 3a2fc92b by BellCodeEditor

save project

parent 94f8a801
Showing with 5 additions and 2 deletions
with open(r'C:\Users\电脑二号\Desktop\sale_list.txt','r',encoding='utf-8') as a: with open(r'C:\Users\电脑二号\Desktop\sale_list.txt','r',encoding='utf-8') as a:
a=a.readlines() a=a.readlines()
d=[]
for i in a: for i in a:
data=i.split() data=i.split()
sum=0 sum=0
for b in data[1:]: for b in data[1:]:
sum=sum+int(b) sum=sum+int(b)
c=data[0]+str(sum) c=data[0]+str(sum)
print(sum) d.append(c)
\ No newline at end of file with open(r'C:\Users\电脑二号\Desktop\sum_list.txt','a',encoding='utf-8') as b:
b.writelines(d)
\ No newline at end of file
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