Commit fed6e033 by BellCodeEditor

save project

parent c8a02970
Showing with 7 additions and 2 deletions
l=[]
with open(r'c:\Users\003\Documents\lesson13-3\sales_list.txt','r',encoding='utf-8')as aa: with open(r'c:\Users\003\Documents\lesson13-3\sales_list.txt','r',encoding='utf-8')as aa:
bb=aa.readlines() bb=aa.readlines()
for i in bb: for i in bb:
data=i.split() data=i.split()
s=0 s=0
for sales in data[1:]: for sales in data[1:]:
s=s+int(sales) s=s+int(sales)
r=data[0]+" "+str(s) r=data[0]+" "+str(s)
print(r) l.append(r)
with open(r'C:\Users\003\Desktop\test.txt','a',encoding='utf-8')as dd:
dd.writelines(l)
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