× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On Wed, Mar 8, 2017 at 3:08 PM, Kevin Adler <kadler@xxxxxxxxxx> wrote:
FYI, I've used this example in my presentations about Python. Here's the
code when using ibm_db_dbi:

As far as I'm concerned, that's the canonical form for a quick dump of
a table to a workbook.

It's possible it could be made even simpler in handling the headers, but
the code fits on one slide, so I didn't work any harder (plus it shows off
the enumerate() function in Python).

I don't see anything simpler. You could save one line by getting rid
of "headers" as a temporary variable, but to me that's not a good
trade because then you create a longer, more complicated line later.
Other attempts to shave lines also increase complexity.

"Fits on a slide" (without artificial line breaks) is actually quite a
good heuristic to use when deciding whether a chunk of Python code is
suitably simple.

John Y.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.