Commit 722ca927 by BellCodeEditor

auto save

parent 9234ba46
Showing with 8 additions and 3 deletions
with open(r'c:\Users\eszcdr\Documents\lesson13-1\sales_list.txt','r',encoding='UTF_8')as file:
a=file.readlines()
file_sum=[]
file_sum=[]
for i in a:
date=i.split()
sum=0
......@@ -8,12 +8,17 @@ for i in a:
for sales in date[1:]:
sum=sum+int(sales)
b=date[0]+str(sum)+'\n'
print(b)
file_sum.append(b)
with open(r'C:\Users\eszcdr\Desktop','w',encoding='UTF_8')as file:
with open(r'C:\Users\eszcdr\Desktop\new.txt','w',encoding='UTF-8')as file:
file.writelines(file_sum)
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