Reputation: 1361
I know that I can do getpass.getuser()
but that shows the user's name, not their account logon username and I want their account logon username
Upvotes: 1
Views: 564
Reputation: 13407
Try this one:
For Unix
import os
import pwd
pwd.getpwduid(os.getuid())[0]
For Windows
import os
os.getlogin()
Upvotes: 1