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 技術手冊 第三版
244
|
7 章 核心內建功能和標準程式庫模組
zip zip(seq,*seqs)
v2 中,回傳元組所成的一個串列( a list of tuples),其中第
n
個元
組含有來自各個引數序列的第
n
個元素。
zip
至少必須以一個引數呼叫,
而所有的引數都必須是可迭代的(iterable)。如果那些 iterables 的長
度不同,
zip
會回傳長度與最短的 iterable 相同的一個串列,忽略其他
可迭代物件尾端的項目。也請參閱本表中的
map
,以及表 7-5 中的
izip_
longest
。在 v3 中,
zip
會回傳一個迭代器(iterator),而非一個串列,因
此它等同於一個產生器運算式(generator expression),而非一個串列概
括式(list comprehension)。
sys 模組
sys
模組的屬性所繫結的資料與函式,提供了 Python 直譯器(interpreter
的或會直接影響到直譯器的狀態資訊。表 7-3 涵蓋了
sys
最常被使用的
屬性,以字母順序列出。我們沒有涵蓋的大多數屬性都是特別要給除錯
器(debuggers)、效能側寫器(profilers)與整合開發環境(integrated
development environments)使用的,更多資訊請參閱線上文件(
https://
docs.python.org/3/library/sys.html
)。平台特定的資訊最好是使用
platform
模組來取用,涵蓋於線上文件(
https://docs.python.or ...
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