Commit f01498e0 by BellCodeEditor

auto save

parent 1a702943
Showing with 6 additions and 79 deletions
with open(r'c:\Users\Administrator\Documents\lesson13-1\sales_list.txt','r',encoding="utf-8") as file:
a = file.readlines()
asdfg=[]
for i in a:
a = i.split()
#print(a[1:])
sum = 0
for sales in a[1:]:
sum += int(sales)
s=a[0] + str(sum)
print(s)
s=a[0] + str(sum) + '\n'
asdfg.append(s)
with open(r'c:\Users\Administrator\Documents\lesson13-1\sales_listl.txt','a',encoding="utf-8") as file:
file.writelines(asdfg)
\ 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