October 15, 2009 · homework

It seems that several people are still a little bit confused about what I would like you to do for homework 7. Your program should function much like any other UNIX program. For example, consider the wc program. I can use wc to count the words from several files. (From the resources/py directory)

 wc args.py opts.py auto_histling.py

I specified three files on the command line, separated by spaces.

The output should be something like:

 37     116     895 args.py
 34     105     847 opts.py
 77     335    3167 auto_histling.py
148     556    4909 total

Note that the columns are nicely aligned. Your program should work in a similar way, except that it will be printing out mean word and sentence length.

The getopt method will return a list of options and arguments. The arguments should be the filenames you specified on the command line. You will want to loop over the arguments and process each file one at a time.

Rob

Written by Robert Felty


1 Comment to “A note on homework 7”

  1. robfelty says:

    Also note that this homework does not involve the use of stdin, even though we did talk about that in class some today.

Leave a Reply

You must be logged in to post a comment.

Subscribe without commenting