Commit eda384bb by BellCodeEditor

auto save

parent 19aa8e7b
Showing with 11 additions and 3 deletions
...@@ -2,10 +2,14 @@ with open(r'c:\Users\XMBC\Documents\lesson13-1\sales_list.txt','r',encoding='utf ...@@ -2,10 +2,14 @@ with open(r'c:\Users\XMBC\Documents\lesson13-1\sales_list.txt','r',encoding='utf
a=file.readlines() a=file.readlines()
#print(a) #print(a)
l=0
for i in a: for i in a:
new_i=i.split() new_i=i.split()
#print(new_i[1:]) #print(new_i[1:])
sun=0 sun=0
for sales in new_i[1:]: for sales in new_i[1:]:
sun=sum+int(sales) sun=sun+int(sales)
print(sun) s=new_i[0]+str(sun)+'\n'
\ No newline at end of file l.append(s)
with open(r'c:\Users\XMBC\Desktop\新建文本文档.txt','r',encoding='utf-8') as file:
file.writelines(final_)
\ No newline at end of file
a=['你好呀\n','悟空\n','我在贝人编程学python\n']
with open(r'C:/Users/CM/Desktop/happy.txt','a',encoding=utf-8) as file:
flie.writelines(a)
\ 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