f=open('ceshi.txt','a',encoding='utf-8')r=open('ceshi.txt','r',encoding='utf-8')上面的2种写法可以用with来写:with open('ceshi.txt','a',encoding='utf-8') as f:或with open('ceshi.txt','r',encoding='utf-8') as r:这两个写法不需要用f.close()和r.close() #ceshi.txt里面已经分行展示了first…