Python surpasses Perl in popularity?
John Machin
sjmachin at lexicon.net
Tue Nov 25 02:13:26 EST 2008
On Nov 25, 4:57 pm, david.l... at preisshare.net wrote:
> Quoting John Machin <sjmac... at lexicon.net>:
>
> > I'll try again: On what grounds do you assert that "Many libraries,
> > aren't as sophisticated - ie spreadsheet reading and writing."? What
> > Python spreadsheet reading and writing libraries have you used? In
> > what way are they less sophisticated than their perl counterparts? Do
> > you have any particular enhancement requests?
>
> Hi John,
>
> Since you asked a second time and appear genuinely interested - I will
> answer properly. :-)
>
> pyExcelorator - Setting column widths. Doesn't seem to work.
pyExcelerator is abandonware. Check out xlwt (a fork of pyExcelerator)
at http://pypi.python.org/pypi/xlwt
What are the symptoms of setting column widths not seeming to be
working?
>
> Nor setting attrributes in sheets. Things seem to be only half done
> when compared to what I have seen in Perl.
>
> Perl was much easier to get the same functionality working.
If you mean cell formatting, check out the new easyxf functionality in
xlwt.
> Here is my particular complaint:
> from pyExcelerator import *
> # -- Adjust the column width
> if dbf1.fieldDefinitions()[f].fieldInfo()[1] == 'C':
The above code looks like it's accessing the metadata for the f'th
column/field in a dBase file; nothing to do with pyExcelerator.
> ws.col(f).width = 0x0d00 + (f * 600)
With slightly more meaningful names:
worksheet.col(col_index).width = 0x0d00 + col_index * 600
Not sure why you're multiplying by the dbf field number; wouldn't the
dbf field size be a better bet?
In any case, this is merely an elaboration of the basic functionality
column_object.width = expression
How would you prefer to express it?
> in perl....
> $sheet1->set_column(0, 0, 20);
> perl works nicely... I couldn't find a way to so easily set a column width...
I'm guessing that this is equivalent to the pyExcelerator/xlwt code
sheet1.col(0).width = 20 * 256
(column width in Excel is in 256ths of a standardised character)
> plus.. colours are all broken...
"All broken" meaning what?
> If you can shed any light on it for me, I would be thankful.
I hope that helped a little on the write side; what were your problems
on the read side?
You might like to join the discussion group at http://groups.google.com/group/python-excel
Cheers,
John
More information about the Python-list
mailing list