Hi all, I want a script o list all the user-names on my system.
I saw a script that has that feature on line, and tore it down, But I'm stuck on how to simplify it any more.
Heres where Im at:
Code:#!/usr/bin/python import pwd import operator # Load all of the user data, sorted by username all_user_data = pwd.getpwall() userz = sorted((u for u in all_user_data if not u.pw_name.startswith('_')), key=operator.attrgetter('pw_name')) # Print the data for u in userz: print (u.pw_name)
and here is where this script came from:
Any insight would be much appreciated.