Commit b0fa0449 by BellCodeEditor

save project

parent dc008c17
Showing with 6 additions and 1 deletions
with open(r'C:\Users\Administrator\Documents\lesson13_2\sales_list.txt','r',encoding='utf-8') as abc:
a=abc.readlines()
uuu=[]
for i in a:
b=i.split()
#print(b[1:])
bac=0
for cab in b[1:]:
bac=bac+int(cab)
ufo=b[0]+str(bac)
ufo=b[0]+str(bac)+'\n'
uuu.append(ufo)
print(ufo)
with open(r'C:\Users\Administrator\Documents\lesson13_2\sales_list.txt','w',encoding='utf-8') as ab:
ab.writelines(uuu)
\ 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