File对象的方法 open() open()方法用于打开一个文件,并返回文件对象。 Attention:使用该方法需要调用close()关闭文件 # open(file, mode='r') 常用模式 >>> fileweriter = open("D:\\test.txt","w+") >>> fo.close()