导航

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

文件和目录访问¶

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

  • pathlib --- 面向对象的文件系统路径
    • 基础使用
    • 纯路径
      • 通用性质
      • 运算符
      • 访问个别部分
      • 方法和特征属性
    • 具体路径
      • 方法
    • 对应的 os 模块的工具
  • os.path --- 常见路径操作
  • fileinput --- Iterate over lines from multiple input streams
  • stat --- Interpreting stat() results
  • filecmp --- 文件及目录的比较
    • dircmp 类
  • 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
      • copytree example
      • rmtree example
    • Archiving operations
      • Archiving example
    • Querying the size of the output terminal
  • macpath --- Mac OS 9 路径操作函数

参见

模块 os

操作系统接口,包括处理比 Python 文件对象 更低级别文件的功能。

模块 io

Python的内置 I/O 库,包括抽象类和一些具体的类,如文件 I/O 。

内置函数 open()

使用 Python 打开文件进行读写的标准方法。

上一个主题

operator --- 标准运算符替代函数

下一个主题

pathlib --- 面向对象的文件系统路径

本页

  • 提交 Bug
  • 显示源代码

导航

  • 索引
  • 模块 |
  • 下一页 |
  • 上一页 |
  • Python »
  • zh_CN 3.7.4 文档 »
  • Python 标准库 »
  • |
© 版权所有 2001-2019, Python Software Foundation.
Python 软件基金会是一个非盈利组织。 请捐助。
最后更新于 7月 25, 2019. 发现了问题?
使用Sphinx2.0.1 创建。