Commit b4c208d7 by BellCodeEditor

save project

parent ac19bf91
Showing with 11 additions and 6 deletions
q=open(r'c:\Users\玛酷\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8')
a=q.readlines()
print(a)
r=[]
for i in a:
data=i.split()
#print(data[1:])
z=0
for q in data[1:]:
z+=int(q)
print(z)
z=0
for t in data[1:]:
z=z+int(t)
e=data[0]+str(z)+"\n"
r.append(e)
with open(r'c:\Users\玛酷\Documents\lesson13-1\sales_list.txt','w',encoding='utf-8') as q:
q.writelines(r)
\ 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