How do I find out the user's name regardless of platform?

Asked 2 years ago, Updated 2 years ago, 144 views

uname = getUserName() I'm looking for a function to figure out the user name in this way.

I looked it up os.getuid works only on UNIX (and returns id, not name) pwd module is only available on Unix.

I hope it's a function that can be used on all platforms, but if not, at least it's a function that supports Linux and Windows at the same time.

python portability username

2022-09-21 15:26

1 Answers

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.