Skip to content

Instantly share code, notes, and snippets.

@suganoo suganoo/01_get_username.py
Last active Nov 10, 2017

Embed
What would you like to do?
ユーザー名の取得
import os
import getpass
import pwd
print(os.getlogin())
print(getpass.getuser())
print(os.environ.get("USER"))
print(pwd.getpwuid(os.getuid())[0])
fuga # <--- fuga ユーザーでログイン後hogeに変更したから
hoge
hoge
hoge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.