Commit caa33fa1 by BellCodeEditor

save project

parent 1298ddfe
Showing with 8 additions and 3 deletions
with open(r'\Users\john\Desktop\tv.txt','r',encoding='utf-8') as file1:
a=file1.readlines()
sum1=[]
for i in a:
data=i.split()
sum=0
for k in data[1:]:
sum=sum+int(k)
sum=data[0]+str(sum)
# with open(r'\Users\john\Desktop\v.txt','w',encoding='utf-8') as file1:
# file1.write(sum)
sum=data[0]+str(sum)+'\n'
sum1.append(sum)
with open(r'\Users\john\Desktop\v.txt','w',encoding='utf-8') as file1:
print(sum1)
file1.writelines(sum1)
\ 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