Commit 62b2b213 by BellCodeEditor

save project

parent 4c3c4df3
Showing with 5 additions and 3 deletions
with open(r"c:\Users\Administrator\Documents\lesson13-3\sales_list.txt","r",encoding="utf-8")as Ze: with open(r"c:\Users\Administrator\Documents\lesson13-3\sales_list.txt","r",encoding="utf-8")as Ze:
Z=Ze.readlines() Z=Ze.readlines()
q=[]
for i in Z: for i in Z:
#print(i) #print(i)
C=i.split() C=i.split()
...@@ -7,7 +8,8 @@ for i in Z: ...@@ -7,7 +8,8 @@ for i in Z:
a=0 a=0
for i in C[1:]: for i in C[1:]:
a=a+int(i) a=a+int(i)
d=C[0]+str(a) d=C[0]+str(a)+"/n"
print(d) q.append(d)
with open(r"c:\Users\Administrator\Documents\lesson13-3\sales_list.txt","w",encoding="utf-8")as Ze:
Ze.writelines(q)
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