Commit fb7d5bfc by BellCodeEditor

save project

parent d9c28676
Showing with 16 additions and 2 deletions
......@@ -12,4 +12,18 @@ a.write('刘若若 11 11 13 11 20 15 13 29 24\n')
a.write('刘阳 11 15 22 11 23 26 22 15 17 52 12\n')
a.write('王胜男 27 15 15 26 13 12 15\n')
a.write('王娇 12 11 12 12 15 35 23 11\n')
a.close()
\ No newline at end of file
a.close()
a=open(r'C:\Users\66433\Desktop\111.txt','r',encoding='utf-8')
q=a.readlines()
#print(q)
final_sun=[]
for i in q:
data=i.split()
#print(data[1:])
s=0
for sales in data[1:]:
s=s+int(sales)
w=data[0]+str(s)+'\n'
final_sun.append(w)
with open(r'C:\Users\66433\Desktop\11.txt','w',encoding='utf-8')as al:
al.writelines(final_sun)
\ 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