大方服饰

文章
4
资源
0
加入时间
3年2月3天

python中的with用法详解

抛出问题之前写一些Python小工具,读写文件都是这样搞的:#!/usr/bin/env pythonfileReader = open('students.txt', 'r')for row in fileReader: print(row.strip())fileReader.close()基本也实现了读取文件的功能。但是有的时候,上述代码在运行的时候会抛出异常,导...