Commit 40e5e254 by BellCodeEditor

auto save

parent 8926250f
Showing with 6 additions and 3 deletions
with open(r"c:\Users\Administrator\Documents\lesson13-1\sales_list.txt",'r',encoding="utf-8") as gstu:
a=gstu.readlines()
print(type(a[3:5]))
l=[]
for i in a:
b=i.split()
sum=0
for j in b[1:]:
sum=sum+int(j)
y=b[0]+str(sum)
print(y)
\ No newline at end of file
y=b[0]+str(sum)+'\n'
l.append(y)
with open(r"c:\Users\Administrator\Documents\lesson13-1\sales_list.txt",'r',encoding="utf-8") as gstu:
gstu.writelines(l)
\ 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