diff options
Diffstat (limited to 'devdocs/python~3.12/library%2Fgrp.html')
| -rw-r--r-- | devdocs/python~3.12/library%2Fgrp.html | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/devdocs/python~3.12/library%2Fgrp.html b/devdocs/python~3.12/library%2Fgrp.html new file mode 100644 index 00000000..a196dbc7 --- /dev/null +++ b/devdocs/python~3.12/library%2Fgrp.html @@ -0,0 +1,28 @@ + <span id="grp-the-group-database"></span><h1>grp — The group database</h1> <p>This module provides access to the Unix group database. It is available on all Unix versions.</p> <div class="availability docutils container"> <p><a class="reference internal" href="https://docs.python.org/3.12/library/intro.html#availability"><span class="std std-ref">Availability</span></a>: Unix, not Emscripten, not WASI.</p> </div> <p>Group database entries are reported as a tuple-like object, whose attributes correspond to the members of the <code>group</code> structure (Attribute field below, see <code><grp.h></code>):</p> <table class="docutils align-default"> <thead> <tr> +<th class="head"><p>Index</p></th> <th class="head"><p>Attribute</p></th> <th class="head"><p>Meaning</p></th> </tr> </thead> <tr> +<td><p>0</p></td> <td><p>gr_name</p></td> <td><p>the name of the group</p></td> </tr> <tr> +<td><p>1</p></td> <td><p>gr_passwd</p></td> <td><p>the (encrypted) group password; often empty</p></td> </tr> <tr> +<td><p>2</p></td> <td><p>gr_gid</p></td> <td><p>the numerical group ID</p></td> </tr> <tr> +<td><p>3</p></td> <td><p>gr_mem</p></td> <td><p>all the group member’s user names</p></td> </tr> </table> <p>The gid is an integer, name and password are strings, and the member list is a list of strings. (Note that most users are not explicitly listed as members of the group they are in according to the password database. Check both databases to get complete membership information. Also note that a <code>gr_name</code> that starts with a <code>+</code> or <code>-</code> is likely to be a YP/NIS reference and may not be accessible via <a class="reference internal" href="#grp.getgrnam" title="grp.getgrnam"><code>getgrnam()</code></a> or <a class="reference internal" href="#grp.getgrgid" title="grp.getgrgid"><code>getgrgid()</code></a>.)</p> <p>It defines the following items:</p> <dl class="py function"> <dt class="sig sig-object py" id="grp.getgrgid"> +<code>grp.getgrgid(id)</code> </dt> <dd> +<p>Return the group database entry for the given numeric group ID. <a class="reference internal" href="exceptions#KeyError" title="KeyError"><code>KeyError</code></a> is raised if the entry asked for cannot be found.</p> <div class="versionchanged"> <p><span class="versionmodified changed">Changed in version 3.10: </span><a class="reference internal" href="exceptions#TypeError" title="TypeError"><code>TypeError</code></a> is raised for non-integer arguments like floats or strings.</p> </div> </dd> +</dl> <dl class="py function"> <dt class="sig sig-object py" id="grp.getgrnam"> +<code>grp.getgrnam(name)</code> </dt> <dd> +<p>Return the group database entry for the given group name. <a class="reference internal" href="exceptions#KeyError" title="KeyError"><code>KeyError</code></a> is raised if the entry asked for cannot be found.</p> </dd> +</dl> <dl class="py function"> <dt class="sig sig-object py" id="grp.getgrall"> +<code>grp.getgrall()</code> </dt> <dd> +<p>Return a list of all available group entries, in arbitrary order.</p> </dd> +</dl> <div class="admonition seealso"> <p class="admonition-title">See also</p> <dl class="simple"> <dt> +<code>Module</code> <a class="reference internal" href="pwd#module-pwd" title="pwd: The password database (getpwnam() and friends). (Unix)"><code>pwd</code></a> +</dt> +<dd> +<p>An interface to the user database, similar to this.</p> </dd> <dt> +<code>Module</code> <a class="reference internal" href="spwd#module-spwd" title="spwd: The shadow password database (getspnam() and friends). (deprecated) (Unix)"><code>spwd</code></a> +</dt> +<dd> +<p>An interface to the shadow password database, similar to this.</p> </dd> </dl> </div> <div class="_attribution"> + <p class="_attribution-p"> + © 2001–2023 Python Software Foundation<br>Licensed under the PSF License.<br> + <a href="https://docs.python.org/3.12/library/grp.html" class="_attribution-link">https://docs.python.org/3.12/library/grp.html</a> + </p> +</div> |
