Project 1: getting a feel for python


In this first project you will get used to python syntax with an smaller program that acts like a log file processor. This small program will still allow you to test some of the python libraries and modules out and try out python in a variety of simple tasks like file handling, arithmatic and text processing. Small text processing programs are a very common form of in-house programming that many programmers find themselves writing on a regular basis.


Write a python program that will take its first command line argument as a file name. Open that file and produce the following output from the file. Each item should be formatted nicely, labeled (so a casual reader knows which number is the number of lines, the number of words and so on.) and on its own line in the output. The output should contain all of the following:

This program generates statistics, many real applications would go one step further and modify the files in place. Such applications are useful in system administration and web management.

If your program in python is longer than about a page, you are probably making this assignment more complicated than it needs to be.


We'll discuss this. I'm moving to a online submission mechinism, but since I've never used it for a large class yet, I'm not ready to assume all is well and have you use it late at night when I'm not on to help. So we'll probably submit from the server in class next week.