Commit f96a5cdf by BellCodeEditor

save project

parent 389f52a1
Showing with 6 additions and 3 deletions
with open(r'C:\Users\Administrator\Desktop\sales_list.txt','r',encoding='utf-8')as file:
a=file.readlines()
Sans=[]
for i in a:
new_i = i.split()
#print(new_i[0])
......@@ -7,5 +8,7 @@ for i in a:
sum=0
for sales in new_i[1:]:
sum = sum+int(sales)
new_1=new_i[0]+str(sum)
print(new_1)
\ No newline at end of file
new_1=new_i[0]+str(sum)+'\n'
Sans.append(new_1)
with open(r'C:\Users\Administrator\Desktop\sales_list.txt','w',encoding='utf-8')as file:
file.writelines(Sans)
\ 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