Such as title,I would like to use the python script to get the windows operating system currently logged in user name, login time and status, not all users. I checked for a long time did not find the right way to find the right way to help. I checked for a long time did not find the right way to find the right way to help.
Asked
Active
Viewed 142 times
0
-
Possible duplicate of [How to get the user login/logoff time by Python for both Windows & Linux?](http://stackoverflow.com/questions/16490309/how-to-get-the-user-login-logoff-time-by-python-for-both-windows-linux) – Michał Gacka Mar 30 '17 at 06:36
-
if you know how to get the info for all users then just filter it by the current user name (`getpass.getuser()`): `current_user_info = next(info for info in all_users_info if info['name'] == getpass.getuser())` See [Is there a portable way to get the current username in Python?](http://stackoverflow.com/q/842059/4279) – jfs Mar 30 '17 at 13:06