上一话题

pwd — 口令数据库

下一话题
就业培训     下载中心     Wiki     联络
登录   注册

Log
  1. 首页
  2. Python 3.12.4
  3. 索引
  4. 模块
  5. 下一
  6. 上一
  7. Python 标准库
  8. Unix 特定服务
  9. grp — 组数据库

grp — 组数据库 ¶


This module provides access to the Unix group database. It is available on all Unix versions.

可用性 :Unix,非 Emscripten,非 WASI。

Group database entries are reported as a tuple-like object, whose attributes correspond to the members of the group structure (Attribute field below, see <grp.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() or getgrgid() )。

It defines the following items:

grp. getgrgid ( id ) ¶

Return the group database entry for the given numeric group ID. KeyError is raised if the entry asked for cannot be found.

3.10 版改变: TypeError is raised for non-integer arguments like floats or strings.

grp. getgrnam ( name ) ¶

Return the group database entry for the given group name. KeyError is raised if the entry asked for cannot be found.

grp. getgrall ( ) ¶

Return a list of all available group entries, in arbitrary order.

另请参阅

模块 pwd

An interface to the user database, similar to this.

模块 spwd

An interface to the shadow password database, similar to this.

上一话题

pwd — 口令数据库

下一话题

termios — POSIX 样式 tty 控制

本页

  • 报告 Bug
  • 展示源

快速搜索

键入搜索术语或模块、类、函数名称。

  1. 首页
  2. Python 3.12.4
  3. 索引
  4. 模块
  5. 下一
  6. 上一
  7. Python 标准库
  8. Unix 特定服务
  9. grp — 组数据库

版权所有  © 2014-2026 乐数软件    

工业和信息化部: 粤ICP备14079481号-1