On this page
  1. pwd.getpwuid
  2. Import
  3. Signature & Overview
  4. Usage
  5. Gotchas
  6. REPL Inspect

pwd.getpwuid

Prev: pwd.getpwnam | Up: pwd | Next: pwd.struct_passwd
Rel: pwd.getpwall, pwd.getpwnam, pwd.struct_passwd
Ref: docs.python.org — pwd.getpwuid
Tags: #public #python3 #stdlib #pwd


Import

import pwd
from pwd import getpwuid

Signature & Overview

pwd.getpwuid(uidobj, /)

Return the password database entry for the given numeric user ID.

Usage

import os, pwd

entry = pwd.getpwuid(os.getuid())
assert entry.pw_uid == os.getuid() and len(entry.pw_dir) > 0

Gotchas

REPL Inspect

from pwd import getpwuid
help(getpwuid)

Linked from

Related notes