Commit af33d0e4 by BellCodeEditor

save project

parent 69fca0c8
Showing with 13 additions and 13 deletions
with open(r'/Users/zll/Desktop/sales_list.txt','r',encoding='utf-8') as f:
with open(r'/Users/zll/Desktop/sale_list.txt','r',encoding='utf-8') as f:
a=f.readlines()
zz=[]
for i in a:
aa=i.split()
sum=0
for x in aa[1:]:
sum=sum+int(x)
qq=aa[0]+str(sum)
zz.append(qq)
print(zz)
\ No newline at end of file
zz=[]
for i in a:
aa=i.split()
sum=0
for x in aa[1:]:
sum=sum+int(x)
qq=aa[0]+str(sum)
zz.append(qq)
print(zz)
with open(r'/Users/zll/Desktop/sale_list.txt','a',encoding='utf-8') as f:
f.write(zz)
\ 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