Commit 0db28d85 by BellCodeEditor

save project

parent 3111ca13
Showing with 6 additions and 2 deletions
with open(r"c:\Users\lenovo\Documents\lesson13_2\sales_list.txt","r",encoding="utf-8") as q:
a = q.readlines()
fs = []
for i in a:
data = i.split()
sum = 0
for s in data[1:]:
sum += int(s)
b = data[0] + str(sum)
print(b)
b = data[0] + str(sum) + "\n"
fs.append(b)
with open(r"c:\Users\lenovo\Documents\lesson13_2\q_list.txt","w",encoding="utf-8") as g:
g.writelines(fs)
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