Commit f23cd377 by BellCodeEditor

auto save

parent 5ec53ebb
Showing with 16 additions and 0 deletions
with open(r'c:\Users\Administrator\Desktop\sales_list.txt','r',encoding='utf-8') as flie:
a=flie.readlines()
#print(a)
y=[]
for i in a:
ii=i.split()
#print(ii[1:])
sum=0
for x in ii[1:]:
sum+=int(x)
iii=ii[0]+str(sum)+'\n'
y.append(iii)
with open(r'c:\Users\Administrator\Desktop\newsales_list.txt','a',encoding='utf-8')as flie:
flie.writelines(y)
\ 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