Commit f328e0c9 by BellCodeEditor

auto save

parent dcec64f1
Showing with 19 additions and 2 deletions
with open('sales_list.txt','r',encoding='utf-8') as f:
k=f.readlines()
new_list=[]
for i in k:
t=i.strip().split()
sum=0
for a in t[1:]:
sum+=int(a)
result=t[0]+str(sum)
print(result)
result=t[0]+str(sum)+"\n"
new_list.append(result)
with open('new_sales_list.txt','w',encoding='utf-8') as f:
f.writelines(new_list)
\ No newline at end of file
悟空348
诺依380
小贝182
李丽201
宋扬107
王明245
李强164
孙小白222
苏琪137
刘若若147
刘阳226
王胜男123
王娇131
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