# process each word in a text file and return new string suitable for printing or writing out to another file

 

def process_file(fn):

    f = open(fn)

    outStr = ""

    for line in f:

        # split on space character - preserves punctuation and newline characters

        lineList = line.split(" ")

        lineListOut = []

        for word in lineList:

            # subprocess() is some other process that may be required (for example convert to pig latin)

            # for each word and is not defined here

            # lineListOut.append(subprocess(word))

            lineListOut.append(word)

        outStr += " ".join(lineListOut)

    f.close()

    print outStr

 

 

fn = (os.path.join('H:\\', 'TEMP', 'temsys', 'Anchor Rod Plans.txt'))

process_file(fn)