Commit fa2c18e3 by BellCodeEditor

save project

parent 9c463359
Showing with 7 additions and 5 deletions
with open(r'c:\Users\l\Desktop\sales_list.txt',"r",encoding='utf-8') as file:
a=file.readlines()
final_sum=[]
sss=[]
for i in a:
newdata=i.split()
#print(newdata[0])
......@@ -8,10 +8,12 @@ for i in a:
sum=0
for sales in newdata[1:]:
sum=sum+int(sales)
ljtyyzs=newdata[0]+str(sum)
final_sum.append(ljtyyzs)
with open(r'c:\Users\l\Desktop\sales_list.txt',"r",encoding='utf-8') as file:
a=file.writelines(ljtyyzs)
ljtyyzs=newdata[0]+str(sum)+'\n'
sss.append(ljtyyzs)
with open(r'c:\Users\l\Desktop\sales_list.txt',"a",encoding='utf-8') as file:
file.writelines('\n')
file.writeline(sss)
......
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