Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a python script that uses a csv.reader to loop through the records in your local /etc/passwd file and extract all the user descriptions (ie.

Write a python script that uses a csv.reader to loop through the records in your local /etc/passwd file and extract all the user descriptions (ie. the fifth field).

It should basically be the Python equivalent of the following pipeline:

$ cat /etc/passwd | cut -d : -f 5 | sed '/^\s*$/d' | env LC_ALL=C sort 

Skeleton:

import csv # Constants PATH = '/etc/passwd' # TODO: Loop through ':' delimited data in PATH and extract the fifth field # (user description) users = None for record in csv.reader(None): pass # TODO: Print user descriptions in sorted order for user in sorted(users): pass

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data And Information Quality Dimensions, Principles And Techniques

Authors: Carlo Batini, Monica Scannapieco

1st Edition

3319241060, 9783319241067

More Books

Students also viewed these Databases questions

Question

How do Data Types perform data validation?

Answered: 1 week ago

Question

How does Referential Integrity work?

Answered: 1 week ago