Commit 7d8b7c55 by BellCodeEditor

auto save

parent 73cdb074
Showing with 5 additions and 1 deletions
with open(r'c:\Users\18725\Documents\lesson13-1\sales_list.txt','r',encoding="utf-8") as file:
a=file.readlines()
f=[]
for i in a:
n=i.split()
z=0
for s in n[1:]:
z=z+int(s)
print(n[0]+str(z))
z=n[0]+str(z)+'\n'
f.append(z)
with open(r'C:\Users\18725\Desktop\name.txt','w',encoding='utf-8') as file1:
file1.writelines(f)
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