新聞中心
nis —- Sun 的 NIS (黃頁) 接口
從版本 3.11 開始標記為過時,將在版本 3.13 中移除。: nis 模塊已被棄用(請參閱 PEP 594 了解詳情)。

nis 模塊提供了對 NIS 庫的輕量級包裝,適用于多個主機的集中管理。
因為 NIS 僅存在于 Unix 系統(tǒng),此模塊僅在 Unix 上可用。
Availability: not Emscripten, not WASI.
This module does not work or is not available on WebAssembly platforms wasm32-emscripten and wasm32-wasi. See WebAssembly platforms for more information.
nis 模塊定義了以下函數(shù):
nis.match(key, mapname, domain=default_domain)
返回 key 在映射 mapname 中的匹配結(jié)果,如無結(jié)果則會引發(fā)錯誤 (nis.error)。 兩個參數(shù)都應為字符串,key 定長 8 個比特。 返回值為任意字節(jié)數(shù)組(可包含 NULL 和其他特殊值)。
請注意如果 mapname 是另一名稱的別名則會先檢查別名。
domain 參數(shù)可允許重載用于查找的 NIS 域。 如果未指定,則會在默認 NIS 域中查找。
nis.cat(mapname, domain=default_domain)
返回一個字典,其元素為 key 到 value 的映射使得 match(key, mapname)==value。 請注意字典的鍵和值均為任意字節(jié)數(shù)組。
請注意如果 mapname 是另一名稱的別名則會先檢查別名。
domain 參數(shù)可允許重載用于查找的 NIS 域。 如果未指定,則會在默認 NIS 域中查找。
nis.maps(domain=default_domain)
返回全部可用映射的列表。
domain 參數(shù)可允許重載用于查找的 NIS 域。 如果未指定,則會在默認 NIS 域中查找。
nis.get_default_domain()
返回系統(tǒng)默認的 NIS 域。
nis 模塊定義了以下異常:
exception nis.error
當 NIS 函數(shù)返回一個錯誤碼時引發(fā)的異常。
網(wǎng)站名稱:創(chuàng)新互聯(lián)Python教程:nis —- Sun 的 NIS (黃頁) 接口
本文路徑:http://m.fisionsoft.com.cn/article/cdsojhh.html


咨詢
建站咨詢
