ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
### 导航 - [索引](../genindex.xhtml "总目录") - [模块](../py-modindex.xhtml "Python 模块索引") | - [下一页](crypt.xhtml "crypt --- Function to check Unix passwords") | - [上一页](spwd.xhtml "spwd --- The shadow password database") | - ![](https://box.kancloud.cn/a721fc7ec672275e257bbbfde49a4d4e_16x16.png) - [Python](https://www.python.org/) » - zh\_CN 3.7.3 [文档](../index.xhtml) » - [Python 标准库](index.xhtml) » - [Unix 专有服务](unix.xhtml) » - $('.inline-search').show(0); | # [`grp`](#module-grp "grp: The group database (getgrnam() and friends). (Unix)") --- The group database - - - - - - This module provides access to the Unix group database. It is available on all Unix versions. Group database entries are reported as a tuple-like object, whose attributes correspond to the members of the `group` structure (Attribute field below, see `<pwd.h>`): 索引 属性 意义 0 gr\_name the name of the group 1 gr\_passwd the (encrypted) group password; often empty 2 gr\_gid the numerical group ID 3 gr\_mem all the group member's user names 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 `gr_name` that starts with a `+` or `-` is likely to be a YP/NIS reference and may not be accessible via [`getgrnam()`](#grp.getgrnam "grp.getgrnam") or [`getgrgid()`](#grp.getgrgid "grp.getgrgid").) 本模块定义如下内容: `grp.``getgrgid`(*gid*)Return the group database entry for the given numeric group ID. [`KeyError`](exceptions.xhtml#KeyError "KeyError")is raised if the entry asked for cannot be found. 3\.6 版后已移除: Since Python 3.6 the support of non-integer arguments like floats or strings in [`getgrgid()`](#grp.getgrgid "grp.getgrgid") is deprecated. `grp.``getgrnam`(*name*)Return the group database entry for the given group name. [`KeyError`](exceptions.xhtml#KeyError "KeyError") is raised if the entry asked for cannot be found. `grp.``getgrall`()Return a list of all available group entries, in arbitrary order. 参见 Module [`pwd`](pwd.xhtml#module-pwd "pwd: The password database (getpwnam() and friends). (Unix)")An interface to the user database, similar to this. 模块 [`spwd`](spwd.xhtml#module-spwd "spwd: The shadow password database (getspnam() and friends). (Unix)")针对影子密码数据库的接口,与本模块类似。 ### 导航 - [索引](../genindex.xhtml "总目录") - [模块](../py-modindex.xhtml "Python 模块索引") | - [下一页](crypt.xhtml "crypt --- Function to check Unix passwords") | - [上一页](spwd.xhtml "spwd --- The shadow password database") | - ![](https://box.kancloud.cn/a721fc7ec672275e257bbbfde49a4d4e_16x16.png) - [Python](https://www.python.org/) » - zh\_CN 3.7.3 [文档](../index.xhtml) » - [Python 标准库](index.xhtml) » - [Unix 专有服务](unix.xhtml) » - $('.inline-search').show(0); | © [版权所有](../copyright.xhtml) 2001-2019, Python Software Foundation. Python 软件基金会是一个非盈利组织。 [请捐助。](https://www.python.org/psf/donations/) 最后更新于 5月 21, 2019. [发现了问题](../bugs.xhtml)? 使用[Sphinx](http://sphinx.pocoo.org/)1.8.4 创建。