我正在用 python 进行文件操作,我发现了两个模块, “打开”和"file"这两个文件操作模块有什么区别 在功能方面我发现两者相同。
谢谢。
最佳答案
Python 2.x 文档 says it all :
When opening a file, it’s preferable to use
open()
instead of invoking this constructor [file()
] directly.file
is more suited to type testing (for example, writingisinstance(f, file)
).
在 Python 3.x 中,file
不再可用。
关于python - python文件操作模块open和file的区别。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6859499/