Python Glossary Русский

all Python 3Linux · macOSosfunction

os.getgid

os — user/group IDs

Return the process's real group id (GID). Availability: Unix.

Syntax

os.getgid(...)

The real GID is the primary group of the user who started the process. Access is checked against the effective GID and supplementary groups, given by getegid and getgroups. grp.getgrgid(os.getgid()).gr_name gives the group name.

Examples

import os
print(os.getgid())  # → ? только Unix: реальный GID процесса, например 1000
print(os.getgid() == os.getegid())  # → ? только Unix: True — реальный и эффективный GID обычно совпадают
print(os.getgid() in os.getgroups())  # → ? только Unix: обычно True — основная группа входит в набор групп процесса

See also

Open in the full glossarydocs.python.orgReport an inaccuracy