Commit ad3e6292 by BellCodeEditor

save project

parent e8712890
Showing with 13 additions and 0 deletions
with open(r'c:\Users\HW\Documents\lesson13_2\sales_list.txt','r','encoding=uft-8') as file:
str=file.readlines()
a=[]
for data in str:
new_data=data.split()
sum=0
for i in new_data[1:]:
sum+=int(i)
result=new_data[0]+str(sum)
a.append(result)
with open(r'c:\Users\HW\Documents\lesson13_2\sales_list.txt','a','encoding=uft-8') as file:
file.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