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 技術手冊 第三版
mmap 模組
|
479
poll p.poll()
檢查子行程是否終止了,然後回傳
p.returncode
wait p.wait()
等候子行程終止,然後回傳
p.returncode
。在 v3 中,也接受一個選擇性
timeout
引數。
mmap 模組
mmap
模組提供記憶體映射(memory-mapped)的檔案物件。一個
mmap
物件
的行為類似於一個位元組字串(bytestring),所以你通常可以把一個
mmap
物件傳入預期位元組字串的地方。然而,還是有差異存在:
mmap
物件不提供字串物件的方法。
mmap
物件是可變的,然而字串物件是不可變的。
一個
mmap
物件也對應到一個開啟的檔案,其行為與 Python 的檔案物件
多型(如前面的「類檔案物件與多型」中所涵蓋的)。
一個
mmap
物件
m
也可以被索引或切片,產出位元組字串。因為
m
是可變
的,你也可以對
m
的一個索引動作或切片動作進行指定(assign)。然而,
當你指定至
m
的一個切片,指定述句的右手邊必須是一個位元組字串,其
長度與作為你指定目標的切片完全相同。因此,串列切片指定(涵蓋於
前面的「修改一個串列」中)的許多實用技巧有許多不適用於
mmap
切片
指定。
mmap
模組提供一個工廠函式(factory function),它在類 Unix 系統上和在
Windows 上有些微的差異:
mmap mmap(filedesc,length,tagname='', access=None, offset=None)
Windows
mmap( ...
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 进行数据分析(原书第2版)

利用 Python 进行数据分析(原书第2版)

Wes McKinney

Publisher Resources

ISBN: 9789864766819