Commit 17777181 by BellCodeEditor

save project

parent d1536a55
Showing with 15 additions and 0 deletions
with open(r'c:\Users\MKJQR\Desktop\xxs.txt','r',encoding='utf-8') as file:
with open(r'c:\Users\MKJQR\Desktop\xxs.txt','r',encoding='utf-8') as file:
a=file.readlines()
n=0
c=[]
for i in a:
s=i.split()
sum=0
for u in s[1:]:
sum+=int(u)
n=s[0]+' '+str(sum)+'\n'
c.append(n)
with open(r'c:\Users\MKJQR\Desktop\xxs.txt','a',encoding='utf-8') as file:
file.writelines(c)
\ 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