Commit 591cefe0 by BellCodeEditor

save project

parent a8bb2b8c
Showing with 7 additions and 2 deletions
with open(r'C:\Users\周\Desktop\a.txt','r',encoding='utf-8') as a:
aa=a.readlines()
s=[]
for a in aa:
a=a.split()
q=0
for i in a[1:]:
q=q+int(i)
print(a[0]+str(q))
\ No newline at end of file
d=a[0]+' '+str(q)+'\n'#print()
s.append(d)
with open(r'C:\Users\周\Desktop\a.txt','w',encoding='utf-8') as a:
a.writelines(s)
\ 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