python中file是一个变量,不是一个文件格式
将open函数赋值给变量file只是为了使代码写起来更方便更美观
示例如下:
使用变量file之前:
open("ax.txt",'a').write('1234566') open("ax.txt",'a').close()
使用变量file之后:
file=open("ax.txt",'a') file.write('1234566') file.close()
更多Python知识,请关注:Python自学网!!
上一篇
python怎么打断点看步骤
下一篇
python ndarray数组对象有什么特点
四叶天代理IP,专业代理IP厂家,主营动态、静态、长效、短效、住宅IP。