Commit df3feff0 by BellCodeEditor

save project

parent 2dabc0aa
Showing with 7 additions and 4 deletions
with open(r'c:\Users\GCZL\Documents\lesson13_2\sales_list.txt','r',encoding='utf-8') as z:
a=z.readlines()
# print(type(a[3:5]))
kop=[]
for i in a:
s=i.split()
su=0
for b in s[1:]:
su=su+int(b)
p=s[0]+str(su)
print(p)
\ No newline at end of file
su=su+int(b)
p=s[0]+str(su)+'\n'
kop.append(p)
print(p)
with open(r'c:\Users\GCZL\Documents\lesson13_2\salesnm_list.txt','a',encoding='utf-8') as lkl:
lko=lkl.writelines(kop)
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