On this page
pwd.struct_passwd
Prev: pwd.getpwuid | Up: pwd
Rel: pwd.getpwall, pwd.getpwnam, pwd.getpwuid
Ref: docs.python.org โ pwd.struct_passwd
Tags: #public #python3 #stdlib #pwd
Import
import pwd
from pwd import struct_passwd
Signature & Overview
pwd.struct_passwd(iterable=(), /)
pwd.struct_passwd: Results from getpw*() routines.
Methods & Attributes
struct_passwd.count(self, value, /)โ Return number of occurrences of value.struct_passwd.index(self, value, start=0, stop=9223372036854775807, /)โ Return first index of value.
Usage
import os, pwd
entry = pwd.getpwuid(os.getuid())
assert isinstance(entry, pwd.struct_passwd) and hasattr(entry, "pw_shell")
Gotchas
- Fields:
pw_name,pw_passwd,pw_uid,pw_gid,pw_gecos,pw_dir,pw_shell.
REPL Inspect
from pwd import struct_passwd
help(struct_passwd)
Linked from
Related notes
- tuts/python3/stdlib_module/pwd/getpwall Linked here; links to this page; shared tags: #pwd, #stdlib
- tuts/python3/stdlib_module/pwd/getpwnam Linked here; links to this page; shared tags: #pwd, #stdlib
- tuts/python3/stdlib_module/pwd/getpwuid Linked here; links to this page; shared tags: #pwd, #stdlib
- tuts/python3/stdlib_module/pwd Linked here; links to this page; shared tags: #stdlib
- tuts/c/stdlib shared tags: #stdlib
- tuts/c/stdlib/assert shared tags: #stdlib
- tuts/c/stdlib/assert/assert shared tags: #stdlib
- tuts/c/stdlib/assert/static_assert shared tags: #stdlib
- tuts/c/stdlib/ctype shared tags: #stdlib
- tuts/c/stdlib/ctype/isalpha shared tags: #stdlib