>
> 3) Open the .txt file in Excel, remove the few lines I don't need (ie
> single quotes, etc)
Regarding Excel, you can write your output directly to an Excel file from
python using the Python-Excel module. Just install all three packages. I use
them all the time.
Here is something that I wrote just yesterday which writes data to sheets
one and three in an existing notebook.
from xlrd import open_workbook
> from xlutils.copy import copy
> from xlwt import easyxf
def insert_excel(self, exfile, insert_list):
> book = open_workbook(exfile, formatting_info = True)
> copy_book = copy(book)
> copy_sheet = copy_book.get_sheet(0)
> copy_sheet_two = copy_book.get_sheet(2)
> plain = easyxf('')
> allp = len(insert_list)
> for row, listx in enumerate(insert_list):
> listx = self.formater(listx)
> print row +1, ' of ', allp
> if len(listx) > 250:
> first_list = listx[0:250]
> second_list = listx[250:]
> for i, cell in enumerate(first_list):
> copy_sheet.write(row+2, i, cell, plain)
> for i, cell in enumerate(second_list):
> try:
> copy_sheet_two.write(row+2, i, cell, plain)
> except ValueError:
> break
> else:
> for i, cell in enumerate(listx):
> copy_sheet.write(row+2, i, cell, plain)
> copy_book.save(exfile)
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor