Commit 21da6211 by BellCodeEditor

save project

parent 200e31e1
Showing with 21 additions and 3 deletions
with open(r"c:\Users\EDY\Documents\lesson13-4\sales_list.txt","r",encoding="utf_8") as file: with open(r"c:\Users\EDY\Documents\lesson13-4\sales_list.txt","r",encoding="utf_8") as file:
a=file.readlines() a=file.readlines()
kong=[]
for i in a: for i in a:
data=i.split() data=i.split()
print(data[0]) sum=0
print(data[1:]) for j in data[1:]:
\ No newline at end of file sum=sum+int(j)
s=data[0]+str(sum)+"\n"
kong.append(s)
with open(r"c:\Users\EDY\Documents\lesson13-4\sales_list1.txt","w",encoding="utf_8") as file:
file.writelines(kong)
悟空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