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

pwd.getpwnam

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


Import

import pwd
from pwd import getpwnam

Signature & Overview

pwd.getpwnam(name, /)

Return the password database entry for the given user name.

Usage

import os, pwd

name = pwd.getpwuid(os.getuid()).pw_name
assert pwd.getpwnam(name).pw_uid == os.getuid()

Gotchas

REPL Inspect

from pwd import getpwnam
help(getpwnam)

Linked from

Related notes