I have an application where I need to take a query from an existing database and send it to a web api.
Here's a cut down version of my existing code: for foo in mssql.fetch_array(); bar = foo[2] #trims the first result which we don't use for x in bar: for y in x: print y print This produces each value on a line, here's an example result: Jane Mary SIMPSON 0411231234 Dr I Feelgood 2006-12-27 15:00:00 John DOE None Dr I Feelgood 2006-12-27 15:30:00 Frank SPENCER Dr I Feelgood 2006-12-27 16:00:00 There are always 5 values, but some are blank and some are 'None'. I'd like to split the lines so I get something resembling XML, like this: <FNAME>Frank</FNAME> <SNAME>Spencer</SNAME> <PHONE></PHONE> <DR>Dr I Feelgood</DR> <TIME>2006-12-27 16:00:00</TIME> Thanks in advance for your help, Peter. -- http://mail.python.org/mailman/listinfo/python-list