Commit 8fe76c14 by BellCodeEditor

auto save

parent b2ecb454
Showing with 10 additions and 2 deletions
with open(r'c:\Users\Windows 10\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8') as a: with open(r'c:\Users\Windows 10\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8') as a:
b=a.readlines() b=a.readlines()
hhh=[]
for i in b: for i in b:
bata=i.split() bata=i.split()
sum=0 sum=0
for sb in bata[1:]: for sb in bata[1:]:
sum=sum+int(sb) sum=sum+int(sb)
sa=bata[0]+str(sum) sa=bata[0]+str(sum)+'\n'
print(sa) hhh.append(sa)
with open(r'c:\Users\Windows 10\Documents\lesson13-1\sales_list.txt','w',encoding='utf-8') as a:
a.writelines(hhh)
\ 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