Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cross platform solution for getting current login name in Python [duplicate]

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.

like image 596
bogdan Avatar asked Sep 16 '10 07:09

bogdan


1 Answers

getpass.getuser() is your friend.

like image 192
Amber Avatar answered Oct 15 '22 00:10

Amber