Last active
August 29, 2015 14:28
-
-
Save sujayy1983/ae12ce225690c109b7fd 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
""" | |
Description: Get current username. Useful in automation. | |
""" | |
#Approach1 | |
import os | |
import pwd | |
pwd.getpwuid( os.getuid() ).pw_name | |
#Approach2 | |
import getpass | |
print getpass.getuser() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment