Commit 38278b54 by BellCodeEditor

save project

parent 5ec53ebb
Showing with 17 additions and 0 deletions
with open (r'C:\Users\Administrator\Desktop\abc.txt','r',encoding='utf-8')as file:
abc=file.readlines()
#print(abc)
sum_h=[]
for i in abc:
#print(i)
data=i.split()
sum=0
#print(data[1:])
for a in data[1:]:
sum=sum+int(a)
result=data[0]+str(sum)+'\n'
sum_h.append(result)
with open(r'C:\Users\Administrator\Desktop\abc.txt','a',encoding='utf-8')as file:
file.writelines(sum_h)
\ 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