Commit 4b2de6e2 by BellCodeEditor

save project

parent b3b0711a
Showing with 3 additions and 7 deletions
with open(r"d:\a\sales_list.txt","r",encoding="utf-8") as b: with open(r"d:\a\sales_list.txt","r",encoding="utf-8") as b:
a=b.readlines() a=b.readlines()
c=[]
for i in a: for i in a:
data=i.split() data=i.split()
sum=0 sum=0
for i in data[1:]: for i in data[1:]:
sum=sum+int(i) sum=sum+int(i)
d=data[0]+str(sum)+"\n" d=data[0]+str(sum)
c.append(d) print(d)
\ No newline at end of file
with open(r"d:\a\sales_list.txt","a",encoding="utf-8") as b:
b.writelines(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