Commit 40b3c942 by BellCodeEditor

save project

parent d65d37b4
Showing with 5 additions and 2 deletions
with open(r'C:\Users\Administrator\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8') as file:
a=file.readlines()
#print(a)
f=[]
for i in a:
c=i.split()
# print(c[0])
d=0
for b in c[1:]:
d+=int(b)
print(c[0]+str(d))
with open(r'C:\Users\Administrator\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8') as file:
u=c[0]+str(d)+'\n'
f.append(u)
#print(c[0]+str(d))
with open(r'C:\Users\Administrator\Documents\lesson13-1\new_sales_list.txt','a',encoding='utf-8') as file:
file.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