python文件操作,自动关闭

with opne("text.txt", encoding="utf8") as f,

  open("text2.txt", encoding="utf8") as f2 :

  pass

 

with代码块执行完就自动close文件、

posted @ 2018-10-15 10:32  jeff9571  阅读(957)  评论(0)    收藏  举报