Commit 59fad77b by BellCodeEditor

save project

parent 2d244e7b
Showing with 23 additions and 0 deletions
with open(r"c:\Users\Administrator\Documents\lesson13-1\sales_list.txt","r",encoding="utf-8") as a:
w=a.readlines()
# print(w)
c=[]
for i in w:
s=i.split()
d=s[1:]
# print(d)
k=0
for n in d:
k=k+int(n)
# print(n)
c.append(s[0]+str(k)+"\n")
with open(r"c:\Users\Administrator\Documents\lesson13-1\sales_list.txt","a",encoding="utf-8") as a:
a.writelines(c)
\ No newline at end of file
李玉成 12 22 34 15 13 12 12 11
陈敬瑄 11 12 12 31 41
五号波 22 21 23
历史元 11 34 45 45
唐太宗 55 66 77 88李玉成131陈敬瑄107五号波66历史元135唐太宗286
\ 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