Commit efb963c7 by BellCodeEditor

auto save

parent eef1b859
Showing with 16 additions and 3 deletions
a=['...\n','_ _ _\n','...\n']
with open(r"c:\Users\Administrator\Desktop\hello.txt",'a',encoding='utf-8') as file:
file.writelines(a)
\ No newline at end of file
with open(r"C:\Users\Administrator\Documents\lesson13-1\sales_list.txt",'r',encoding='utf-8') as file: with open(r"C:\Users\Administrator\Documents\lesson13-1\sales_list.txt",'r',encoding='utf-8') as file:
a=file.readlines() a=file.readlines()
# print(a) # print(a)
for i in a: abc=[]
print(i) for i in a:
\ No newline at end of file date=i.split()
# print(date[1:])
sum=0
for sales in date[1:]:
sum=sum+int(sales)
result=date[0]+str(sum)+'\n'
abc.append(result)
with open(r"c:\Users\Administrator\Desktop\new_sale.txt",'a',encoding='utf-8') as file:
file.writelines(abc)
\ 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