with语句 操作未见对象,不管在处理文件中是否发生异常,在with语句结束后都会关闭文件。 用法: With open(“file_name”) as somefile: for line in somefile: print(line) ("There is an entire future of incredible things waiting for you." --《十三个原因:幕后故事》)