Skip to content

Instantly share code, notes, and snippets.

@andrewdyates
Created June 27, 2012 04:43
Show Gist options
  • Save andrewdyates/3001507 to your computer and use it in GitHub Desktop.
Save andrewdyates/3001507 to your computer and use it in GitHub Desktop.
get current username in Python
# http://stackoverflow.com/questions/842059/is-there-a-portable-way-to-get-the-current-username-in-python
import os, pwd
username = pwd.getpwuid(os.getuid()).pw_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment