Commit a382de5d by BellCodeEditor

save project

parent 0cc37ad4
Showing with 16 additions and 0 deletions
with open(r'c:\Users\Administrator\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8')as a:
w=a.readlines()
y=[]
for i in w:
z=i.split()
#print(z[1:])
i=0
for l in z[1:]:
i=i+int(l)
k=z[0]+str(i)+'\n'
y.append(k)
with open(r'c:\Users\Administrator\Documents\lesson13-1\sales_list.txt','w',encoding='utf-8')as a:
a.writelines(y)
\ No newline at end of file
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