Commit e7ad4042 by BellCodeEditor

save project

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