Commit 3321f17b by BellCodeEditor

auto save

parent c078e0f6
Showing with 12 additions and 0 deletions
with open(r'c:\Users\Administrator\Desktop\sales_list.txt','r',encoding='utf-8') as file:
a=file.readlines()
ns = []
for i in a:
d = i.split()
s = 0
for sales in d[1:]:
s = s + int(sales)
zh = d[0] + str(s) + '\n'
ns.append(zh)
with open(r'c:\Users\Administrator\Desktop\sales_list.txt','a',encoding='utf-8') as file:
file.writelines(ns)
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