<div dir="ltr"><br><br><div class="gmail_quote">On Sat, Aug 30, 2008 at 9:32 PM, Marin Brkic <span dir="ltr"><mbrkic@invalid_mail.adress></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Sat, 30 Aug 2008 17:18:19 -0700 (PDT), John Machin<br>
<<a href="mailto:sjmachin@lexicon.net">sjmachin@lexicon.net</a>> wrote:<br>
<br>
<br>
Hello John (and everyone else), thanks for answering.<br>
<div class="Ih2E3d"><br>
>It helps in situations like this to mention details of your<br>
>environment<br>
>(1) what version of what operating system (Linux, OS X, Windows, etc)<br>
>(2) what version of Python<br>
>as the available solutions are often dependent on the answers.<br>
<br>
</div>Yes, of course. I sometimes forget the most essential of things.<br>
- winxp, sp2<br>
- python 2.5.2<br>
<div class="Ih2E3d"><br>
><br>
>For Python version 2.[345] on any platform, you can use xlwt, which is<br>
>as simple as this for writing a 1-worksheet Excel 97-to-2003 XLS file<br>
>(without any formatting):<br>
<br>
</div>Actually, that might work. What I was needing (aiming for) was a way<br>
to write to excel 2003 files. Formatting is not necessary, since what<br>
I'm trying to write is some tabular data; results from fortran-python<br>
simulation (I can explain, but the details seem irrelevant for this<br>
case).<br>
I'm trying to avoid the text file - import to excel - mechanism, since<br>
there is quite a lot of files written.<br>
<div class="Ih2E3d">><br>
>def write_xls(file_name, sheet_name, data):<br>
>    import xlwt<br>
>    book = xlwt.Workbook()<br>
>    sheet = book.add_sheet(sheet_name)<br>
>    rowx = 0<br>
>    for row in data:<br>
>        rowx += 1<br>
>        for colx, value in enumerate(row):<br>
>            sheet.write(rowx, colx, value)<br>
>    book.save(file_name)<br>
># data can be any of the following Python types: int, long, float,<br>
>decimal.Decimal, datetime.date, datetime.datetime, bool, str, and<br>
>unicode.<br>
><br>
>xlwt is available from <a href="https://secure.simplistix.co.uk/svn/xlwt/trunk" target="_blank">https://secure.simplistix.co.uk/svn/xlwt/trunk</a><br>
><br>
>I suggest that you join the python-excel group (http://<br>
><a href="http://groups.google.com.au/group/python-excel?hl=en" target="_blank">groups.google.com.au/group/python-excel?hl=en</a>) or at least read some<br>
>of the questions and responses.<br>
<br>
</div>Please, one more question. As you have noticed, I posted my message to<br>
comp.lang.python, using a newsreader. Is there a way to access google<br>
groups through a similiar interface program as a newsreader. Never<br>
used them before, and getting a lot of messages to my email every day<br>
does not sound very appealing to me.<br>
<br></blockquote><div><br>You can register for google groups, subscribe to the group, and go to My Account -> Manage Subscriptions and select "No Email" for the subscription type. That way, you can do everything (post, read, etc.) from <a href="http://groups.google.com">groups.google.com</a> and not have to worry about filling up your email inbox.<br>
</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
Best regards<br>
<font color="#888888">Marin<br>
</font><div><div></div><div class="Wj3C7c"><br>
><br>
>HTH,<br>
><br>
>John<br>
--<br>
<a href="http://mail.python.org/mailman/listinfo/python-list" target="_blank">http://mail.python.org/mailman/listinfo/python-list</a><br>
</div></div></blockquote></div><br></div>