Commit bbb3c3eb by BellCodeEditor

auto save

parent 5ec53ebb
Showing with 15 additions and 0 deletions
with open(r"C:\Users\74902\Desktop\new_sum.txt",'r',encoding="utf-8") as f:
one = f.readlines()
sum_list=[]
for i in one:
data = i.split()
name = data[0]
sum_ = data[1:]
num=0
for i in sum_:
num+=int(i)
new_sum= name+":"+str(num)+"\n"
sum_list.append(new_sum)
with open(r"C:\Users\74902\Desktop\new_sum1.txt",'a',encoding="utf-8") as f:
f.writelines(sum_list)
\ 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