[Edu-sig] gnu news from pdx / 97214

kirby urner kirby.urner at gmail.com
Wed Dec 1 00:37:36 CET 2010


Some of you may recall how a few months
ago I was angsting about the little feud that
seems to go on twixt computer language
families, a flavor of religious war, or maybe
more "hillbilly" in some dimensions.[0]

I'm speaking in particular of the functional
vs. imperative rift.  Python gets along famously
with the Java community be comparison, but
then these are both OO.[1]

Anyway I'm revisiting that issue, having a
diplomatic exchanges on math-thinking-l
with some of the good people there (also
off-list).[2]

Also, thanks to Aahz, I've been in touch
with an OpenStudy guy named Jon and
invited him to join us.  Lets see if he does.
http://openstudy.com/

Perhaps old hat to some of you, I've been
clued about xlrd and xlwt, FOSS modules
that let you write Excel files even if you
don't have Excel.  I'll append some example
code I've been working on.[3]

Kirby

"97214 -- the zip code of geniuses"

[0]
http://studiohourglass.blogspot.com/2010/10/yall-come-back-now-hillbilly.html
slow to load, subcultural iconography -- seems to take forever actually,
might be my Chrome buffer?

[1]
http://danielkaes.wordpress.com/2010/01/26/what-is-the-most-popular-programming-language/

[2] http://mybizmo.blogspot.com/2010/11/olive-branch.html
If you follow links, you might get to some of
my multiple choice examples, like:

Mulitple choice:

Which are special names for operations in Python
(mark all that apply):
(a) __add__
(b) subtract
(c) __special__
(d) __mul__

[3]

"""
prototype:  reads DBF format, outputs XLS format
"""

from xlwt import Workbook, easyxf
import dbfpy.dbf
from time import time

def test1():
    dbf = dbfpy.dbf.Dbf("C:\\ktraks6\\feecode.dbf", readOnly = True)

    header_style = easyxf('font: name Arial, bold True, height 200;')

    book = Workbook()
    sheet1 = book.add_sheet('Sheet 1')

    for (i, name) in enumerate(dbf.fieldNames):
        sheet1.write(0, i, name, header_style)

    for (i, thecol) in enumerate(dbf.fieldDefs):
        name, thetype, thelen, thedec = str(thecol).split()
        colwidth = max(len(name), int(thelen))
        # print colwidth
        sheet1.col(i).width = colwidth * 310

    for row in range(1,len(dbf)):
        for col in range(len(dbf.fieldNames)):
            sheet1.row(row).write(col, dbf[row][col])

    book.save("C:\\Documents and Settings\\HP_Administrator\\My
Documents\\Visual FoxPro Projects\\feecode.xls")

if __name__ == "__main__":
    start = time()
    test1()
    end = time()
    print end - start
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/edu-sig/attachments/20101130/db7208d0/attachment.html>


More information about the Edu-sig mailing list