导航

  • 索引
  • 模块 |
  • 下一页 |
  • 上一页 |
  • Python »
  • zh_CN 3.8.0a2 文档 »
  • Python 标准库 »
  • |

文件和目录访问¶

本章中描述的模块处理磁盘文件和目录。 例如,有一些模块用于读取文件的属性,以可移植的方式操作路径以及创建临时文件。 本章的完整模块列表如下:

  • pathlib --- Object-oriented filesystem paths
    • Basic use
    • Pure paths
      • General properties
      • 运算符
      • Accessing individual parts
      • Methods and properties
    • Concrete paths
      • Methods
    • Correspondence to tools in the os module
  • os.path --- Common pathname manipulations
  • fileinput --- Iterate over lines from multiple input streams
  • stat --- Interpreting stat() results
  • filecmp --- File and Directory Comparisons
    • The dircmp class
  • tempfile --- Generate temporary files and directories
    • 示例
    • Deprecated functions and variables
  • glob --- Unix style pathname pattern expansion
  • fnmatch --- Unix filename pattern matching
  • linecache --- Random access to text lines
  • shutil --- High-level file operations
    • Directory and files operations
      • Platform-dependent efficient copy operations
      • copytree example
      • rmtree example
    • Archiving operations
      • Archiving example
    • Querying the size of the output terminal

参见

模块 os
操作系统接口,包括处理比 Python 文件对象 更低级别文件的功能。
模块 io
Python的内置 I/O 库,包括抽象类和一些具体的类,如文件 I/O 。
内置函数 open()
使用 Python 打开文件进行读写的标准方法。

上一个主题

operator --- Standard operators as functions

下一个主题

pathlib --- Object-oriented filesystem paths

本页

  • 提交 Bug
  • 显示源代码

导航

  • 索引
  • 模块 |
  • 下一页 |
  • 上一页 |
  • Python »
  • zh_CN 3.8.0a2 文档 »
  • Python 标准库 »
  • |
© 版权所有 2001-2019, Python Software Foundation.
Python 软件基金会是一个非盈利组织。 请捐助。

最后更新于 3月 26, 2019. Found a bug?
使用Sphinx1.8.4 创建。