Write the simple getcol tool in python

Assignment Help Python Programming
Reference no: EM132318596

In this assignment you will write the simple getcol tool in Python 3. It extracts a subset of columns of data from a file which has data organized in columns. It is a lot like the tool we built in class. But it has more options and features so you can practice parsing and processing options and then using Python 3.

Here is the help message which is gotten by the default -h option:
Usage: getcol [options] {col{:col{:col}}}*

Options:
-h, --help show this help message and exit
-i STR, --insep=STR input separator
-o STR, --outsep=STR output separator
-l STR, --lastsep=STR
last output separator

-s strip each input column of whitespace
The input separator string is what divides the columns. If none is specified then the default of whitespace is used. See the split function.

The output separator string is what separates columns on output. It is only used between two columns that are printed out. If a column that is to be printed is missing on input then it, of course, is not printed and neither is the separator string (see the test data in the side bar). In Python3 there is the "end=" option on the print function. That is very useful to know about. You saw it briefly in class to prevent a newline from being printed.

The last separator string is what is printed after the list of columns. It is the last thing on the line before the newline.
If the strip flag is set then each column is stripped of white space front and back. There is a simple string function for this.

As many columns as desired can be specified on the command line in a list of columns. Columns are numbered starting at 1. Duplicate column numbers are allowed! The columns are printed in the order they are specified in the column list.

Furthermore each column specifier in the the column list may have zero, one, or two separating colons with no whitespace between. So the column specifier may be a num or num:num or num:num:num. These mean:
num mean that column is to be printed.
num1:num2 means starting at column num1 and going to num2. For example: 1:4 means columns 1, 2, 3, 4.
num1:num2:num3 means starting at column num1 and going to num2 in steps of num3. For example 1:8:3 means columns 1, 4, 7 and 4:1:-1 means 4, 3, 2, 1.

An example column specification might be: 2 2 10:11 8:12:2 10 which would print columns: 2, 2, 10, 11, 8, 10, 12, 10 Consider implementing this feature with the range function.
testing

To test your code and better understand the definition of the functions there is a tar/zip in the sidebar that contains test scripts and a makefile for this assignment.

Submission

Homework will be submitted as an uncompressed tar file to the homework submission page linked from the main class page. No makefile is needed for a Python program. Your pogram will be named getcol with no py extension. To invoke Python 3 you put:

#!/usr/bin/env python3 as the first line of your program. This will let you use the python3 that is installed in local environment. FYI: it is Python 3.4. Have fun.

You can submit as many times as you like. The LAST file you submit BEFORE the deadline will be the one graded. For all submissions you will receive email giving you some automated feedback on the unpacking and compiling and running of code and possibly some other things that can be autotested. I will read the results of the runs and the reports you submit.

Reference no: EM132318596

Questions Cloud

Create five to seven interactive math games : For this benchmark, you will plan a Family Math Game Event. You will create five to seven interactive math games for one of the following age groups.
Can the teacher participate in its activities : Do all student-led religious groups have an absolute right to meet at K-12 schools? If not, discuss one limitation under the Equal Access Act. May a teacher be.
Calculate basic eps for the three years : What would Niglow's return on net operating assets need to be for the return on equity to be decreased by financing the expansion using all debt.
How each of the strategies can contribute to your success : Explain how each of these strategies can contribute to your success in online learning. Be sure to practice citing and referencing the course resources you use.
Write the simple getcol tool in python : CS 270 - System Software - University of Idaho - Write the simple getcol tool in Python 3. It extracts a subset of columns of data from a file which has data
How you will maintain your dispositions in the classroom : How you will maintain your dispositions in the classroom, through demonstrating ethical behavior in instruction and assessment.
Which of the following would be the required journal entry : Target Corp. borrowed $106,000 cash on September 1, 2014, and signed a one-year 6%, interest-bearing note payable.
Discuss how you will report the results to families : Discuss how you will report the results to families. Provide at least three tips for families about how they can communicate with you about concerns/questions.
Write down description of weather during games time : For this assignment, you will first select your topic (a city from North America) on the Discussion Board. You may not select a city that has been previously.

Reviews

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd