Skip to Content
Python 技術手冊 第三版
book

Python 技術手冊 第三版

by lex Martelli, Anna Martelli Ravenscroft, Steve Holden
January 2018
Intermediate to advanced content levelIntermediate to advanced
856 pages
17h 17m
Chinese
GoTop Information, Inc.
Content preview from Python 技術手冊 第三版
311
10
檔案與文字作業
本章涵蓋 Python 中處理檔案與檔案系統有關的多數議題。一個
檔案
file
是程式可以讀取或寫入的文字或位元組資料流(stream);一個
案系統
filesystem
是電腦系統上由檔案構成的一個階層架構式的存放庫
a hierarchical repository of files)。
也涉及檔案的其他章節
因為檔案是程式設計中非常重要的概念,雖然本章是本書中最長的一章,
但還有其他幾章也含有處理特定種類檔案時相關的參考資料。特別是,
11 章涵蓋與續存(persistence)和資料庫(database)功能性有關的許
多種檔案(「json 模組」中的 JSON,「 pickle cPickle 模組」中的 pickle
,「 shelve 模組」中的 shelve ,「 v3 dbm 套件」中的DBM
DBM 檔案,以及「SQLite」中的 SQLite 資料庫檔案),第 22 章處理
HTML 格式的檔案和其他資料流,而第 23 章涵蓋 XML 格式的檔案和其他
資料流。
本章的組織方式
檔案與資料流有許多種類:它們的內容可以是任意的位元組或文字(如
果底層的儲存區或管道只處理位元組,就像大多數的那樣,就會有各種
編碼);它們可能適合用於讀取、寫入或兩者皆可;它們可能是
有緩衝的
312
|
10 章 檔案與文字作業
buffered
;它們可能允許「隨機存取(random access)」,可在檔案中前
後移動(舉例來說,底層管道是 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

測試驅動開發|使用 Python

測試驅動開發|使用 Python

Harry J.W. Percival
Linux 内核观测技术BPF

Linux 内核观测技术BPF

David Calavera, Lorenzo Fontana

Publisher Resources

ISBN: 9789864766819