Skip to content

Instantly share code, notes, and snippets.

@suganoo
Last active November 10, 2017 06:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suganoo/ec68249d31deaa889903b259072ae7ef to your computer and use it in GitHub Desktop.
Save suganoo/ec68249d31deaa889903b259072ae7ef to your computer and use it in GitHub Desktop.
ユーザー名の取得
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