Commit 7b3d085c by BellCodeEditor

save project

parent a3c9671c
Showing with 4 additions and 4 deletions
with open("c:\\Users\\玛酷\\Desktop\\sales_list.txt","r",enciding=utf-8) as b: with open("c:\\Users\\玛酷\\Desktop\\sales_list.txt","r",enciding=utf-8) as b:
a=b.readlines() a=b.readlines()
a=[] c=[]
for i in a: for i in a:
data=i.split() data=i.split()
sum=0 sum=0
for seles in data[1:]: for seles in data[1:]:
sum=sum+int(seles) sum=sum+int(seles)
result=data[0]+str(sum)+"\n" result=data[0]+str(sum)+"\n"
a.append(result) c.append(result)
with open("c:\\Users\\玛酷\\Desktop\\sales_list.txt","a",enciding=utf-8) as b: with open("c:\\Users\\玛酷\\Desktop\\sales_list.txt","a",enciding=utf-8) as b:
b.writelines(a) b.writelines(c)
\ No newline at end of file \ 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