KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
What is a portable way (e.g. for Linux and Windows) to get the current user's username? Something similar to os.getuid() would be nice: >>> os.getuid() 42 # Does not currently exist in Python >>> os.getusername() 'slartibartfast' The pwd module works for Unix only. Some people suggest that getting the username under Windows can be complicated in certain circumstances (e.g., running as a Windows service).
Tags (comma-separated)
Save Edits
Cancel