Skip to content

Instantly share code, notes, and snippets.

@jreisinger
Last active July 19, 2019 15:09
Show Gist options
  • Save jreisinger/2219366 to your computer and use it in GitHub Desktop.
Save jreisinger/2219366 to your computer and use it in GitHub Desktop.
#!/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]))
@jreisinger
Copy link
Author

Thanks. I was just playing around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment