Commit 93f4b8e8 by BellCodeEditor

save project

parent 448f611a
Showing with 4 additions and 4 deletions
with open(r'C:\Users\Administrator\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8') as file:
a=file.readlines()
dd=[]
abb=[]
for i in a:
b=i.split()
c_1=0
for x in b[1:]:
c_1=c_1+int(x)
result=b[0]+str(c_1)+'\n'
dd.append(result)
abb.append(result)
with open(r'C:\Users\Administrator\Documents\lesson13-1\sales_list.txt','a',encoding='utf-8') as file:
file.writelines(dd)
\ No newline at end of file
file.writelines(abb)
\ 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