Commit 99e8232b by BellCodeEditor

save project

parent 7fd1fd0d
Showing with 9 additions and 5 deletions
with open(r'D:\test_new.txt','r',encoding='utf-8') as f:
a=f.readlines()
for i in a:
b=f.readlines()
a=[]
for i in b:
data=i.split()
sum=0
for sales in data[1:]:
sum=sum+int(sales)
a=data[0]+str(sum)
print(a)
sum = sum + int(sales)
s = data[0] + str(sum) + '\n'
a.append(s)
with open(r'D:\test_new.txt','a',encoding='utf-8') as f:
f.writelines(a)
\ 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