The nis Module
(Unix only, Optional) The nis
module provides an interface to the NIS
(yellow pages) services, as Example 12-6 shows. It can be used to fetch values from a NIS
database, if available.
Example 12-6. Using the nis Module
File: nis-example-1.py
import nis
import string
print nis.cat("ypservers")
print string.split(nis.match("bacon", "hosts.byname"))
['194.18.155.250', 'bacon.spam.egg', 'bacon', 'spam-010']
Get Python Standard Library now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.