For *nix, you have the pwd and grp modules. You iterate through pwd.getpwall()
to get all users. You look up their group names with grp.getgrgid(gid)
.
import pwd, grp
for p in pwd.getpwall():
print p[0], grp.getgrgid(p[3])[0]
More Related Contents:
- ImageMagick not authorized to convert PDF to an image
- Two versions of python on linux. how to make 2.7 the default
- Pycharm and sys.argv arguments
- Install tkinter for Python
- Pass input/variables to command/script over SSH using Python Paramiko
- os.makedirs doesn’t understand “~” in my path
- What is the simplest way to SSH using Python?
- Run Python script at startup in Ubuntu
- How to activate virtualenv in Linux?
- standard_init_linux.go:178: exec user process caused “exec format error”
- Cross-platform subprocess with hidden window
- Python virtualenv questions
- Cross-platform space remaining on volume using python
- How do I get monotonic time durations in python?
- Get total physical memory in Python
- Format of /dev/input/event*
- ‘yes’ reporting error with subprocess communicate()
- Unable to install pyodbc on Linux
- Python script as linux service/daemon
- How to do sed like text replace with python?
- How to use export with Python on Linux
- After Anaconda installation, conda command fails with “ImportError: no module named conda.cli”
- Cron job: how to run a script that requires to open display?
- Paramiko authentication fails with “Agreed upon ‘rsa-sha2-512’ pubkey algorithm” (and “unsupported public key algorithm: rsa-sha2-512” in sshd log)
- What is different between makedirs and mkdir of os?
- Could not find or load the Qt platform plugin “xcb”
- Python multiprocessing memory usage
- How to move .conda from one folder to another at the moment of creating the environment
- Python – Trap all signals
- How to find the mountpoint a file resides on?