10. File and Directory AccessΒΆ
The modules described in this chapter deal with disk files and directories. For example, there are modules for reading the properties of files, manipulating paths in a portable way, and creating temporary files. The full list of modules in this chapter is:
- 10.1.
os.path
β Common pathname manipulations - 10.2.
fileinput
β Iterate over lines from multiple input streams - 10.3.
stat
β Interpretingstat()
results - 10.4.
statvfs
β Constants used withos.statvfs()
- 10.5.
filecmp
β File and Directory Comparisons - 10.6.
tempfile
β Generate temporary files and directories - 10.7.
glob
β Unix style pathname pattern expansion - 10.8.
fnmatch
β Unix filename pattern matching - 10.9.
linecache
β Random access to text lines - 10.10.
shutil
β High-level file operations - 10.11.
dircache
β Cached directory listings - 10.12.
macpath
β Mac OS 9 path manipulation functions
See also
- Section File Objects
A description of Pythonβs built-in file objects.
- Module
os
Operating system interfaces, including functions to work with files at a lower level than the built-in file object.