Skip to content

Latest commit

 

History

History

842059

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

View on StackOverflow

The easiest way to get the current user name is definitely username.

pip install username

then:

import username
    
print(username())
# your_username

And there is also username-cli, a CLI tool to get your username, just:

pip install username-cli

then:

$ username
# -> your username

Works on Linux, macOS, and Windows