This document is for an old version of Python that is no longer supported. You should upgrade and read the Python 当前稳定版本的文档.

导航

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

10. 文件和目录访问¶

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

  • 10.1. os.path — 常见路径操作
  • 10.2. fileinput — 迭代来自多个输入流的行
  • 10.3. stat — 解析 stat() 结果
  • 10.4. statvfs — Constants used with os.statvfs()
  • 10.5. filecmp — 文件及目录的比较
    • 10.5.1. dircmp 类
  • 10.6. tempfile — 生成临时文件和目录
  • 10.7. glob — Unix 风格路径名模式扩展
  • 10.8. fnmatch — Unix 文件名模式匹配
  • 10.9. linecache — 随机读写文本行
  • 10.10. shutil — 高阶文件操作
    • 10.10.1. 目录和文件操作
      • 10.10.1.1. copytree 示例
    • 10.10.2. 归档操作
      • 10.10.2.1. 归档程序示例
  • 10.11. dircache — Cached directory listings
  • 10.12. macpath — Mac OS 9 路径操作函数

参见

Section File Objects

A description of Python’s built-in file objects.

模块 os

Operating system interfaces, including functions to work with files at a lower level than the built-in file object.

上一个主题

9.9. operator — 标准运算符替代函数

下一个主题

10.1. os.path — 常见路径操作

本页

  • 显示源代码

快速搜索

导航

  • 索引
  • 模块 |
  • 下一页 |
  • 上一页 |
  • Python »
  • Python 2.7.18 文档 »
  • Python 标准库 »
© 版权所有 1990-2020, Python Software Foundation.
Python 软件基金会是一个非盈利组织。 请捐助。
Last updated on 6月 19, 2020. 发现了问题?
使用Sphinx2.3.1 创建。