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