Commit 01e93b0f by BellCodeEditor

auto save

parent 7300bfad
Showing with 4 additions and 3 deletions
with open("c:\\Users\\XMBC\\Documents\\lesson13-1\\sales_list.txt",'r',encoding='utf-8') as f1: with open("c:\\Users\\XMBC\\Documents\\lesson13-1\\sales_list.txt",'r',encoding='utf-8') as f1:
a=f1.readlines() a=f1.readlines()
j=[]
for i in a: for i in a:
s=i.split() s=i.split()
#print(s[1:]) #print(s[1:])
q=0 q=0
j=[]
for d in s[1:]: for d in s[1:]:
q=q+int(d) q=q+int(d)
j.append(s[0]+str(q)+'\n') j.append(s[0]+str(q)+'\n')
with open(r"C:\Users\XMBC\Desktop\blackery.txt",'a',encoding='utf-8') as m:
with open(r"C:\Users\XMBC\Desktop\blackery.txt",'w',encoding='utf-8') as m:
m.writelines(j) m.writelines(j)
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