Commit 3d1fdf22 by BellCodeEditor

save project

parent 2565c59e
Showing with 6 additions and 4 deletions
with open(r'c:\Users\HUAWEI\Desktop\file.txt,'r',encoding='utf-8') as file:
with open(r'c:\Users\HUAWEI\Desktop\file.txt','r',encoding='utf-8')as file:
s=file.readlines()
final_sum=[]
for i in s:
data=i.split()
sum=0
for sales in data[1:]:
sum=sum+int(sales)
result=data[0]+str(sum)+/n
with open(r'c:\Users\HUAWEI\Desktop\sb.txt,'w',encoding='utf-8') as file
file.whitelines()
result=data[0]+str(sum)+'\n'
final_sum.append(result)
with open(r'c:\Users\HUAWEI\Desktop\sb.txt','a',encoding='utf-8')as file:
file.writelines(final_sum)
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