Commit 0924211e by BellCodeEditor

save project

parent a9a2c5c6
Showing with 8 additions and 5 deletions
with open(r'c:\Users\张琰\Desktop\sales_list.txt.txt','r',encoding='utf-8')as file:
a=file.readlines()
final_sum=[]
for i in a:
b=i.split()
date=i.split()
#print(b[1])
sum=0
for sales in b[1:]:
for sales in date[1:]:
sum=sum+int(sales)
c=b[0]+str(sum)
print(c)
\ No newline at end of file
result=date[0]+str(sum)+'\n'
final_sum.append(result)
with open(r'c:\Users\张琰\Desktop\sales_list.txt.txt','a',encoding='utf-8')as file:
file.writelines(final_sum)
\ 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