Commit 86b5de3d by BellCodeEditor

save project

parent d319b5c6
Showing with 12 additions and 2 deletions
with open(r'c:\Users\Administrator\Desktop\sales_list.txt','r',encoding='utf-8')as file1: with open(r'c:\Users\Administrator\Desktop\sales_list.txt','r',encoding='utf-8')as file1:
a=file1.readlines() a=file1.readlines()
print(a)
d=[]
for i in a: for i in a:
b=i.split() b=i.split()
sum=0 sum=0
for sales in b[1:]: for sales in b[1:]:
sum+=int(sales) sum+=int(sales)
c=b[0]+str(sum) c=b[0]+str(sum)+'\n'
print(c) d.append(c)
with open(r'c:\Users\Administrator\Desktop\sales_list.txt','r',encoding='utf-8')as file1:
file.writelines(d)
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