Commit 3cdda9a8 by BellCodeEditor

save project

parent df6a2e90
Showing with 5 additions and 3 deletions
with open(r'C:\Users\Administrator\Desktop\text.txt','r',encoding='gbk')as file: with open(r'C:\Users\Administrator\Desktop\text.txt','r',encoding='gbk')as file:
a=file.readlines() a=file.readlines()
#print(a) #print(a)
p=[]
for i in a: for i in a:
b=i.split() b=i.split()
#print(b) #print(b)
sum=0 sum=0
for c in b[1:]: for c in b[1:]:
sum=sum+int(c) sum=sum+int(c)
d=b[0]+str(sum) d=b[0]+str(sum)+'\n'
print(d) p.append(d)
with open(r'C:\Users\Administrator\Desktop\fj (1).txt','w',encoding='utf-8') as file:
file.writelines(p)
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