Pythonで学ぶ「詳解 UNIXプログラミング」(その6) 第6章 システムデータファイルと情報
6.1 getpwnam関数
import pwd def getpwnam(name): for rec in pwd.getpwall(): if rec.pw_name == name: return rec
パスワードファイル関連の関数はpwdモジュール、シャドウパスワード関連の関数はspwdモジュール、グループファイル関連の関数はgrpモジュールで提供されている。
import pwd def getpwnam(name): for rec in pwd.getpwall(): if rec.pw_name == name: return rec
パスワードファイル関連の関数はpwdモジュール、シャドウパスワード関連の関数はspwdモジュール、グループファイル関連の関数はgrpモジュールで提供されている。