I'm looking for a cross platform solution for getting current login/username in Python.
I was surprised that os.getlogin()
is only supported under Unix and even there is not necessarily returning what you would expect.
getpass.getuser()
is your friend.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With