thanks i will check out the example you have given.actually my html output is a bit dynamic in the sense that i may have different number of rows depending on some inputs. so i am putting everything into a list and using 'extend' to append to that list for every dynamically generated rows using for/while loops. then at the end of the code, i use writelines() to output to the file.
-- http://mail.python.org/mailman/listinfo/python-list