blob: 551171b0302f31b2048df4005c99c405efe427e9 [file] [log] [blame]
Fred Drake3a0351c1998-04-04 07:23:21 +00001\section{Built-in Module \module{grp}}
Guido van Rossume47da0a1997-07-17 16:34:52 +00002\label{module-grp}
Guido van Rossum5fdeeea1994-01-02 01:22:07 +00003
4\bimodindex{grp}
5This module provides access to the \UNIX{} group database.
6It is available on all \UNIX{} versions.
7
8Group database entries are reported as 4-tuples containing the
9following items from the group database (see \file{<grp.h>}), in order:
10\code{gr_name},
11\code{gr_passwd},
12\code{gr_gid},
13\code{gr_mem}.
14The gid is an integer, name and password are strings, and the member
15list is a list of strings.
16(Note that most users are not explicitly listed as members of the
Guido van Rossum470be141995-03-17 16:07:09 +000017group they are in according to the password database.)
Guido van Rossumeb0f0661997-12-30 20:38:16 +000018A \code{KeyError} exception is raised if the entry asked for cannot be found.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000019
20It defines the following items:
21
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000022\begin{funcdesc}{getgrgid}{gid}
23Return the group database entry for the given numeric group ID.
24\end{funcdesc}
25
26\begin{funcdesc}{getgrnam}{name}
27Return the group database entry for the given group name.
28\end{funcdesc}
29
30\begin{funcdesc}{getgrall}{}
Guido van Rossum6bb1adc1995-03-13 10:03:32 +000031Return a list of all available group entries, in arbitrary order.
Guido van Rossum5fdeeea1994-01-02 01:22:07 +000032\end{funcdesc}