faster, "cheaper" (in terms of resources), and more secure would be:
import getpass
user = getpass.getuser()