Last active
November 10, 2017 06:52
-
-
Save suganoo/ec68249d31deaa889903b259072ae7ef to your computer and use it in GitHub Desktop.
ユーザー名の取得
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import getpass | |
import pwd | |
print(os.getlogin()) | |
print(getpass.getuser()) | |
print(os.environ.get("USER")) | |
print(pwd.getpwuid(os.getuid())[0]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fuga # <--- fuga ユーザーでログイン後hogeに変更したから | |
hoge | |
hoge | |
hoge |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment