Commit ca9991e2 by BellCodeEditor

save project

parent 91897e1c
Showing with 2 additions and 2 deletions
with open(r"c:\Users\EDZ\Documents\lesson13-1\sales_list.txt","r",encoding="UTF-8") as file:
a=file.readlines()
sum_a=[]
for i in a:
b=i.split()
# print(b[1:])
sum=0
sum_a=[]
for e in b[1:]:
sum=sum+int(e)
f=b[0]+str(sum)+"\n"
sum_a.append(f)
print(sum_a)
with open(r"c:\Users\EDZ\Desktop\abc.txt","a",encoding="UTF-8") as file1:
with open(r"c:\Users\EDZ\Desktop\abc.txt","w",encoding="UTF-8") as file1:
file1.writelines(sum_a)
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