Michele Simionato michele.simionato at gmail.com
Thu Sep 2 04:29:21 CEST 2004

Benjamin Niemann <b.niemann at betternet.de> wrote in message news:<ch1qdd$jd0$1 at online.de>...
> Perhaps this could help you:
> http://sourceforge.net/projects/pyxlwriter/

Thank you! The distribution contains an example that does exactly what I
want (with minor changes). I report here a snippet just for future

import pyXLWriter as xl

workbook = xl.Writer(xlsfilename)
worksheet = workbook.add_worksheet()

nrow = 0
for chunk in file(textfile).read().split("\n====\n"):
    row = chunk.split('\n\n') # Split on empty line
    for ncol, cell in enumerate(row):
        worksheet.write([nrow, ncol], cell.strip())
    nrow += 1

workbook.close() # needed

More information about the Python-list mailing list