Commit 074d7f90 by BellCodeEditor

auto save

parent 162fb754
Showing with 11 additions and 5 deletions
#a=file b=a c=data d=sum e=sales f=result
#a=file b=a c=data d=sum e=sales f=result g=final_sum
with open(r'c:\Users\Windows 7\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8')as a:
b=a.readlines()
# print(b)
g=[]
for i in b:
c=i.split()
d=0
for e in c[1:]:
d=d+int(e)
f=c[0]+str(d)
print(f)
\ No newline at end of file
f=c[0]+str(d)+'\n'
g.append(f)
with open (r'c:\Users\Windows 7\Desktop\新建文件夹 (3)\c.txt','w',encoding='utf-8') as a:
a.writelines(g)
\ No newline at end of file
a=['你好\n','dsalkf\n']
with open (r'c:\Users\Windows 7\Desktop\新建文件夹 (3)\c.txt','a',encoding='utf-8') as file:
file.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