Commit c3290eed by BellCodeEditor

auto save

parent af406c84
Showing with 22 additions and 0 deletions
ww=open(r'c:\Users\29018\Documents\lesson13-1\sales_list.txt','w',encoding='utf-8')
ww.write('悟空 122 34 67\n积极 23 90 89')
ww.close()
ww=open(r'c:\Users\29018\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8')
b=ww.readlines()
#print(b)
final=[]
for i in b:
da=i.split()
#print(da[1:])
total=0
data=da[1:]
for m in data:
total=total+int(m)
result=da[0]+ ':' +str(total)+'\n'
final.append(result)
#print(result)
with open(r'C:\Users\29018\Desktop\hello.txt','w',encoding='utf-8') as filee:
filee.writelines(final)
\ 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