Commit 33836b5d by BellCodeEditor

save project

parent 94aab0a4
Showing with 12 additions and 1 deletions
with open(r"C:\Users\XMBC\Desktop\新建文本文档.txt",'r',encoding="utf-8") as a: with open(r"C:\Users\XMBC\Desktop\新建文本文档.txt",'r',encoding="utf-8") as a:
b=a.readlines() b=a.readlines()
s=[]
d=0
for i in b: for i in b:
c=i.split() c=i.split()
print(c[1:]) d=0
for n in c[1:]:
d=d+int(n)
s.append(c[0]+":"+str(d)+"\n")
with open(r"C:\Users\XMBC\Desktop\文本文档.txt",'w',encoding="utf-8") as a:
a.writelines(s)
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