檔案與目錄存取¶
本章中描述的 module(模組)用於處理硬碟檔案和目錄。例如,有一些 module 用於讀取檔案的屬性、以可攜 (portable) 方式操作路徑以及建立暫存檔。本章中的完整 module 清單是:
pathlib--- Object-oriented filesystem pathsos.path--- 常見的路徑名操作fileinput--- Iterate over lines from multiple input streamsstat--- Interpretingstat()resultsfilecmp--- File and Directory Comparisonstempfile--- 生成臨時檔案和目錄glob--- Unix 風格的路徑名稱模式擴展fnmatch--- Unix filename pattern matchinglinecache--- Random access to text linesshutil--- High-level file operations