Commit b8b1ed7d by BellCodeEditor

save project

parent 5f999906
Showing with 6 additions and 2 deletions
with open(r'\Users\BBTC\Desktop\sales_list.txt','r',encoding='utf-8') as file:
a=file.readlines()
f=[]
for i in a:
data=i.split()
s=0
for e in data[1:]:
s=s+int(e)
r=data[0]+str(s)
print(r)
r=data[0]+':'+str(s)+'\n'
f.append(r)
with open(r'\Users\BBTC\Desktop\sales_list.txt','a',encoding='utf-8') as file:
file.writelines(f)
\ 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