Commit 8288fc91 by BellCodeEditor

save project

parent 753d716d
Showing with 19 additions and 3 deletions
with open(r'C:\Users\XMBC\Documents\lesson13-1\sales_list.txt',"r",encoding="utf-8") as a: with open(r'C:\Users\XMBC\Documents\lesson13-1\sales_list.txt',"r",encoding="utf-8") as a:
s=a.readlines() s=a.readlines()
q=[]
for i in s: for i in s:
b=i.split() b=i.split()
sum=0 sum=0
for sales in b[1:]: for sales in b[1:]:
sum+=int(sales) sum+=int(sales)
d=b[0]+str(sum) d=b[0]+" "+str(sum)+"\n"
print(d) q.append(d)
with open(r'C:\Users\XMBC\Documents\lesson13-3\sales_list1.txt',"a",encoding="utf-8") as a:
a.writelines(q)
\ No newline at end of file
王娇 131/n悟空 348/n诺依 380/n小贝 182/n李丽 201/n宋扬 107/n王明 245/n李强 164/n孙小白 222/n苏琪 137/n刘若若 147/n刘阳 226/n王胜男 123/n王娇 131/n悟空 348
诺依 380
小贝 182
李丽 201
宋扬 107
王明 245
李强 164
孙小白 222
苏琪 137
刘若若 147
刘阳 226
王胜男 123
王娇 131
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