Commit ae24ac56 by BellCodeEditor

save project

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