Commit 84869670 by BellCodeEditor

save project

parent be28c49c
Showing with 7 additions and 2 deletions
with open(r'C:\Users\EV3-3\Desktop\text.txt.txt','r',encoding='utf-8')as file: with open(r'C:\Users\EV3-3\Desktop\text.txt.txt','r',encoding='utf-8')as file:
a=file.readlines() a=file.readlines()
#print(a) #print(a)
xxx=[]
for i in a: for i in a:
#print(i) #print(i)
data=i.split() data=i.split()
...@@ -9,5 +10,9 @@ for i in a: ...@@ -9,5 +10,9 @@ for i in a:
sum=0 sum=0
for s in data[1:]: for s in data[1:]:
sum+=int(s) sum+=int(s)
new_data=data[0]+str(sum) new_data=data[0]+str(sum)+'\n'
print(new_data) xxx.append(new_data)
with open(r'C:\Users\EV3-3\Desktop\xxx.txt','a',encoding='utf-8')as file:
file.writelines(xxx)
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