On 7/28/06, atanas Cosmas Nkelame <[EMAIL PROTECTED]> wrote: > Hi, > I have a task to write a program that will do the following. > > 1. Run from the command line
Check out the optparse module for this. <http://docs.python.org/lib/module-optparse.html> > 2. Get data from a text file (say data.txt) in the following format > > 111: peter edward [EMAIL PROTECTED] > 112: John sykes [EMAIL PROTECTED] > 113: edward mutaga [EMAIL PROTECTED] Read the text file as normal, and use split to seperate the fields. <http://tinyurl.com/8w8vo> <http://docs.python.org/lib/string-methods.html> > 3. Write that data in a prepared word document (which is essentially a > letter) > > 4. Print the letters for the listed people (111,112,113) on a printer. Word can be driven via COM, so this should be easy enough. See <http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/279003> for a simple example. To find out what you'll need to do, the simplest thing might be to record a Word macro, and look at the VBA code that it generates for you. You can convert this to Python and generalise the bits you need to. There, that's a starting point. Let us know what you come up with! Give us a shout if you have any problems. -- Cheers, Simon B, [EMAIL PROTECTED], http://www.brunningonline.net/simon/blog/ -- http://mail.python.org/mailman/listinfo/python-list