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

  Implement core security features

What you will be implementing here is inspired by real world cases such as the Conficker work. To have any chance of defeating such a threat, you need to understand how they defend themselves.

  Create a child class of basepage for the catalog home page

CS 4320 Homework - Use Python unittest and Selenium WebDriver to create some tests for parts of our university catalog website

  Examine both function implementations

CISC 160 Lab Assignment - Examine both function implementations. Which of these functions is more efficient and why

  Write a program that produces a comparison of the balance

Write a program that produces a comparison of the balance of a bank account over time between simple, monthly and daily methods of compounding interest.

  Define the playround method with only the self parameter

Define the playRound method with only the self parameter. Make a call to another instance method called doRolls that takes no arguements.

  Write a Python script for the ice cream ordering system

Assignment: Below Zero - ice cream store. In this first part of Task, you should write a Python script for the ice cream ordering system

  Question 1 research 5-8 species within one family of birds

question 1 research 5-8 species within one family of birds. be sure to use primary or very good secondary literature

  What good are movie ids and ratings

Implement a function called topRated(). The function will take a file name as a parameter and return a sorted list - What good are movie IDs and ratings? You want to know the actual title of the movie! Implement a function called getTitles(). The fu..

  Implement the ransac algorithm for linear regression

You must find the observed data, threshold, also the outliers and remove them from (X,y) How exactly do i do this? please provide the code.

  Write a python program that generates a small web site

ICT112 Assignment. Your task in this assignment is to write a Python program that generates a small web site to inform Sunshine Coast people about some aspect of the local environment or a local sustainability issue

  Write a program that takes a value from a user

Write a program that takes a value from a user and stores it in the registry. You can use any key name that you like but also store the current time as another value inside of your new key

  Write a password generator in python

Write a password generator in Python. Be creative with how you generate passwords - strong passwords have a mix of lowercase letters, uppercase letters.

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