Commit ed7b39f5 by BellCodeEditor

save project

parent 63933aaa
Showing with 13 additions and 2 deletions
with open("c:\\Users\\1111\\Documents\\lesson13-1\\sales_list.txt","r",encoding="utf-8" )as f:
a=f.readlines()
fg=[]
for i in a:
s=i.split()
# print(s[1:])
sum=0
for b in s[1:]:
sum=sum+int(b)
sd= s[0]+str(sum)
print(sd)
sd= s[0]+str(sum)+"\n"
fg.append(sd)
# print(sd)
with open("c:\\Users\\1111\\Documents\\lesson13-1\\sales_list.txt","w",encoding="utf-8" )as f:
f.writelines(fg)
......
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