Commit 94d482f5 by BellCodeEditor

save project

parent 970aa933
Showing with 8 additions and 3 deletions
with open(r'c:\Users\hhy\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8') as file:
a=file.readlines()
d=[]
for i in a:
w=i.split()
sum=0
for s in w[1:]:
sum=sum+int(s)
f=w[0]+str(sum)
print(f)
\ No newline at end of file
f=w[0]+str(sum)+'\n'
d.append(f)
#print(f)
with open(r'c:\Users\hhy\Documents\lesson13-1\nishisb.txt','a',encoding='utf-8') as file:
file.writelines(d)
\ 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