<br><div>Some of you may recall how a few months </div><div>ago I was angsting about the little feud that</div><div>seems to go on twixt computer language</div><div>families, a flavor of religious war, or maybe</div><div>more "hillbilly" in some dimensions.[0]</div>
<div><br></div><div>I'm speaking in particular of the functional</div><div>vs. imperative rift. Python gets along famously</div><div>with the Java community be comparison, but</div><div>then these are both OO.[1]</div>
<div><br></div><div>Anyway I'm revisiting that issue, having a </div><div>diplomatic exchanges on math-thinking-l</div><div>with some of the good people there (also</div><div>off-list).[2]</div><div><br></div><div>Also, thanks to Aahz, I've been in touch </div>
<div>with an OpenStudy guy named Jon and </div><div>invited him to join us. Lets see if he does.</div><div><a href="http://openstudy.com/">http://openstudy.com/</a></div><div><br></div><div>Perhaps old hat to some of you, I've been</div>
<div>clued about xlrd and xlwt, FOSS modules</div><div>that let you write Excel files even if you </div><div>don't have Excel. I'll append some example</div><div>code I've been working on.[3]</div><div><br></div>
<div>Kirby</div><div><br></div><div>"97214 -- the zip code of geniuses"</div><div><br></div><div>[0] <a href="http://studiohourglass.blogspot.com/2010/10/yall-come-back-now-hillbilly.html">http://studiohourglass.blogspot.com/2010/10/yall-come-back-now-hillbilly.html</a></div>
<div>slow to load, subcultural iconography -- seems to take forever actually,</div><div>might be my Chrome buffer?</div><div><br></div><div>[1] <a href="http://danielkaes.wordpress.com/2010/01/26/what-is-the-most-popular-programming-language/">http://danielkaes.wordpress.com/2010/01/26/what-is-the-most-popular-programming-language/</a></div>
<div><br></div><div>[2] <a href="http://mybizmo.blogspot.com/2010/11/olive-branch.html">http://mybizmo.blogspot.com/2010/11/olive-branch.html</a></div><div>If you follow links, you might get to some of </div><div>my multiple choice examples, like:</div>
<div><br></div><div><span class="Apple-style-span" style="font-family: tahoma, arial, helvetica, sans-serif; font-size: 15px; ">Mulitple choice:</span><span class="Apple-style-span" style="font-family: tahoma, arial, helvetica, sans-serif; font-size: 15px; "><br>
</span><span class="Apple-style-span" style="font-family: tahoma, arial, helvetica, sans-serif; font-size: 15px; "><br></span><span class="Apple-style-span" style="font-family: tahoma, arial, helvetica, sans-serif; font-size: 15px; ">Which are special names for operations in Python</span><span class="Apple-style-span" style="font-family: tahoma, arial, helvetica, sans-serif; font-size: 15px; "><br>
</span><span class="Apple-style-span" style="font-family: tahoma, arial, helvetica, sans-serif; font-size: 15px; ">(mark all that apply):</span><span class="Apple-style-span" style="font-family: tahoma, arial, helvetica, sans-serif; font-size: 15px; "><br>
</span><span class="Apple-style-span" style="font-family: tahoma, arial, helvetica, sans-serif; font-size: 15px; ">(a) __add__</span><span class="Apple-style-span" style="font-family: tahoma, arial, helvetica, sans-serif; font-size: 15px; "><br>
</span><span class="Apple-style-span" style="font-family: tahoma, arial, helvetica, sans-serif; font-size: 15px; ">(b) subtract</span><span class="Apple-style-span" style="font-family: tahoma, arial, helvetica, sans-serif; font-size: 15px; "><br>
</span><span class="Apple-style-span" style="font-family: tahoma, arial, helvetica, sans-serif; font-size: 15px; ">(c) __special__</span><span class="Apple-style-span" style="font-family: tahoma, arial, helvetica, sans-serif; font-size: 15px; "><br>
</span><span class="Apple-style-span" style="font-family: tahoma, arial, helvetica, sans-serif; font-size: 15px; ">(d) __mul__</span></div><div><span class="Apple-style-span" style="font-family: tahoma, arial, helvetica, sans-serif; font-size: 15px; "><br>
</span></div><div>[3]</div><div><br></div><div>"""</div><div>prototype: reads DBF format, outputs XLS format</div><div>"""</div><div><br></div><div><div>from xlwt import Workbook, easyxf</div>
<div>import dbfpy.dbf</div><div>from time import time</div><div><br></div><div>def test1():</div><div> dbf = dbfpy.dbf.Dbf("C:\\ktraks6\\feecode.dbf", readOnly = True)</div><div><br></div><div> header_style = easyxf('font: name Arial, bold True, height 200;')</div>
<div> </div><div> book = Workbook()</div><div> sheet1 = book.add_sheet('Sheet 1')</div><div><br></div><div> for (i, name) in enumerate(dbf.fieldNames):</div><div> sheet1.write(0, i, name, header_style)</div>
<div><br></div><div> for (i, thecol) in enumerate(dbf.fieldDefs):</div><div> name, thetype, thelen, thedec = str(thecol).split()</div><div> colwidth = max(len(name), int(thelen))</div><div> # print colwidth</div>
<div> sheet1.col(i).width = colwidth * 310</div><div><br></div><div> for row in range(1,len(dbf)):</div><div> for col in range(len(dbf.fieldNames)):</div><div> sheet1.row(row).write(col, dbf[row][col])</div>
<div> </div><div> book.save("C:\\Documents and Settings\\HP_Administrator\\My Documents\\Visual FoxPro Projects\\feecode.xls")</div><div><br></div><div>if __name__ == "__main__":</div><div> start = time()</div>
<div> test1()</div><div> end = time()</div><div> print end - start</div><div> </div></div><div><br></div>