Is there a portable way to get the current user's username in Python (i.e., one that works under both Linux and Windows, at least). It would work like
Look at getpass module
import getpass getpass.getuser() 'kostya'
Availability: Unix, Windows
p.s. Per comment below "this function looks at the values of various environment variables to determine the user name. Therefore, this function should not be relied on for access control purposes (or possibly any other purpose, since it allows any user to impersonate any other)."