Commit b863d40f by BellCodeEditor

save project

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