#!/usr/bin/env python

# A skeleton pretty-printing file which reads in an integer and a
# file and creates a list of all the words in the file.  This program
# then prints each word to standard out.

# Make the system namespace available.
# We use the argv member of sys to get
# the command-line arguments
import sys

def main():

    # grab the first argument and make it an integer
    # Note that argv[0] contains the program name
    L = int(sys.argv[1])

    print "You are requesting %s character display" % L

    # create a file handle to the input
    fin = open(sys.argv[2])

    # read() returns the input as one string.
    # split() is a method of string.  By default it tokenizes the
    # input using *whitespace* as a delimeter
    # now words is a list of strings
    words = fin.read().split()

    ### YOU SHOULD MODIFY THIS PART ##################
    print "The list of words is:"
    print

    # cycle through the words and print them out, each on its own line
    for word in words:
        print word

    ##################################################


# read <http://effbot.org/pyfaq/tutor-what-is-if-name-main-for.htm>
if __name__ == '__main__':
    main()

