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

Python 技術手冊 第三版

by lex Martelli, Anna Martelli Ravenscroft, Steve Holden
January 2018
Intermediate to advanced
856 pages
17h 17m
Chinese
GoTop Information, Inc.
Content preview from Python 技術手冊 第三版
os 模組
|
339
zlib 模組
zlib
模組能讓 Python 程式使用免費的 InfoZip
zlib
壓縮程式庫(
http://www.
info-zip.org/pub/infozip/
1.1.4 或之後版本。
zlib
由模組
gzip
zipfile
用,但也能直接用於任何特殊的壓縮需求。
zlib
所提供的最常用的函式
有:
compress compress(s, level=6)
壓縮字串
s
並回傳經過壓縮的資料所成的字串。
level
是介於
1
9
之間
的一個整數:
1
請求一般的壓縮,但作業速度會比較快,而
9
請求最佳的
壓縮,但會耗費更多的計算成本。
decompress decompress(s)
解壓縮經過壓縮的 bytestring
s
,並回傳未壓縮的資料所成的 bytestring
(也接受選擇性的引數用於相當進階的功能,參閱線上文件(https://docs.
python.org/3/library/zlib.html?highlight=zlib#zlib.decompress))。
zlib
模組也提供函式用來計算 CRCCyclic-Redundancy Check,循環冗
餘校驗),它能用來偵測壓縮過的資料和要壓縮的物件中的毀損,並能夠
漸進式地解壓縮資料,以處理太大無法一次放入記憶體中的資料流。對於
這種進階的功能性,請查閱 Python 程式庫的線上文件(
https://docs.python.
org/3/library/zlib.html
)。
os 模組
os
是一個集成模組
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.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

測試驅動開發|使用 Python

測試驅動開發|使用 Python

Harry J.W. Percival

Publisher Resources

ISBN: 9789864766819