Commit d0bdba18 by BellCodeEditor

save project

parent 9b567906
Showing with 6 additions and 3 deletions
a=open(r'c:\Users\周\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8') a=open(r'c:\Users\周\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8')
aa=a.readlines() aa=a.readlines()
lq=[]
for i in aa: for i in aa:
b=i.split() b=i.split()
c=0 c=0
for sales in b[1:]: for sales in b[1:]:
c=c+int(sales) c=c+int(sales)
f=b[0]+str(c) f=b[0]+str(c)+"\n"
print(f) lq.append(f)
\ No newline at end of file with open(r'c:\Users\周\Documents\lesson13-1\sales_list.txt','a',encoding='utf-8') as file:
file.writelines(lq)
\ 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