Commit 82f7f9d0 by BellCodeEditor

save project

parent a956961a
Showing with 9 additions and 2 deletions
......@@ -5,7 +5,11 @@ with open(r'C:\Users\Administrator\Documents\lesson13-3\sales_list.txt','r',enco
for i in a:
data = i.split()
sum = 0
final_sum = []
for a in data[1:]:
sum += int(a)
result = data[0] + str(sum)
print(result)
result = data[0] + str(sum) + '\n'
final_sum.append(result)
with open(r'C:\Users\Administrator\Desktop\text.txt','w','encoding = utf-8')as file:
file.writelines(final_sum)
a = ['jdshi\n','sdaf\n']
wath open(r'C:\Users\Administrator\Desktop\test.txt)
\ 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