Python logo

上個主題

operator --- 標準運算子替代函式

下個主題

pathlib --- Object-oriented filesystem paths

此頁面

  • 回報錯誤
  • 顯示原始碼

瀏覽

  • 索引
  • 模組 |
  • 下一頁 |
  • 上一頁 |
  • Python logo
  • Python »
  • 3.11.8 Documentation »
  • Python 標準函式庫 (Standard Library) »
  • 檔案與目錄存取
  • |
  • |

檔案與目錄存取¶

本章中描述的 module(模組)用於處理硬碟檔案和目錄。例如,有一些 module 用於讀取檔案的屬性、以可攜 (portable) 方式操作路徑以及建立暫存檔。本章中的完整 module 清單是:

  • pathlib --- Object-oriented filesystem paths
    • Basic use
    • 純路徑
      • 通用特性
      • 運算子
      • Accessing individual parts
      • Methods and properties
    • Concrete paths
      • Methods
    • Correspondence to tools in the os module
  • os.path --- 常見的路徑名操作
  • fileinput --- Iterate over lines from multiple input streams
  • stat --- Interpreting stat() results
  • filecmp --- File and Directory Comparisons
    • The dircmp class
  • tempfile --- 生成臨時檔案和目錄
    • 範例
    • 已棄用的函式和變數
  • glob --- Unix 風格的路徑名稱模式擴展
  • 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 範例
    • Archiving operations
      • Archiving example
      • Archiving example with base_dir
    • Querying the size of the output terminal

也參考

Module os

作業系統介面,包括處理比 Python 檔案物件更低階檔案的函式。

Module io

Python 的內建 I/O 函式庫,包含抽象類別和一些具體類別 (concrete class),如檔案 I/O。

內建函式 open()

使用 Python 打開檔案以進行讀寫檔案的標準方法。

上個主題

operator --- 標準運算子替代函式

下個主題

pathlib --- Object-oriented filesystem paths

此頁面

  • 回報錯誤
  • 顯示原始碼
«

瀏覽

  • 索引
  • 模組 |
  • 下一頁 |
  • 上一頁 |
  • Python logo
  • Python »
  • 3.11.8 Documentation »
  • Python 標準函式庫 (Standard Library) »
  • 檔案與目錄存取
  • |
  • |
© 版權 2001-2024, Python Software Foundation.
This page is licensed under the Python Software Foundation License Version 2.
Examples, recipes, and other code in the documentation are additionally licensed under the Zero Clause BSD License.
See History and License for more information.

The Python Software Foundation is a non-profit corporation. Please donate.

最後更新於 Apr 02, 2024 (03:07 UTC)。 Found a bug?
使用 Sphinx 7.2.6 建立。