Commit 42ed129f by BellCodeEditor

save project

parent 1785c508
Showing with 6 additions and 3 deletions
......@@ -5,7 +5,10 @@ with open(r'C:\Users\Administrator\Documents\lesson13-1\sales_list.txt','r',enco
b=i.split()
# print(b[1:])
c_111=0
dd=[]
for i in b[1:]:
c_111=c_111+int(i)
result=b[0]+str(c_111)
print(result)
\ No newline at end of file
result=b[0]+str(c_111)+'\n'
dd.append(result)
with open(r'C:\Users\Administrator\Desktop\test.txt','a',encoding='utf-8') as file:
file.writelines(dd)
\ 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