Last active
July 19, 2019 15:09
-
-
Save jreisinger/2219366 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
file = "/etc/passwd" | |
file_object = open(file, 'r') | |
shell = {} | |
for line in file_object: | |
line = line.strip() | |
fields = line.split(":") | |
shell[fields[0]] = fields[-1] | |
file_object.close() | |
for user in shell.keys(): | |
print("{0:11} => {1}".format(user, shell[user])) |
Thanks. I was just playing around.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey, there are modules for that kind of thing.
See pwd, grp and spwd.