An object exposing a file-oriented API (with methods such as read() or write()) to an underlying resource. Depending on the way it was created, a file object can mediate access to a real on-disk file or to another type of storage or communication device (for example standard input/output, in-memory buffers, sockets, pipes, etc.).
根据我的理解,
open()
函数返回一个file对象,它是指向磁盘上实际资源的指针/句柄。因此,open()
的复杂性应该是恒定的,因为文件的位置被传递到open(file='abc')
函数中。在https://docs.python.org/3/glossary.html#term-file-object
根据操作类型(如
read()
、readline()
、seek()
)、文件大小、系统内存限制和其他文件系统配置,使用file对象执行操作的复杂性会有所不同。在相关问题 更多 >
编程相关推荐