PySIG report, 27 Jan 2011
Bill Sconce
sconce at in-spec-inc.com
Fri Jan 28 20:54:34 EST 2011
Five fearless Python people braved the New Hampshire January evening
last night to venture to the Amoskeag Business Incubator to talk about
Python.
We were fortunate to get one of small meeting rooms, where there is
wired Internet access. Fortunate because the "program" ended up being
one of those magic problem-solving sessions - a sprint if you will.
One of our membership is introducing himself to Python by discovering
for himself how to use it to clean up a name-and-address database.
You know the kind of thing: output by a proprietary package, running
on a proprietary operating system, underlying database also proprietary,
the schema not revealed, etc. Lots of inconsistencies in addresses,
"previous" where should be "current", "Lane" spelled "Ln" sometimes,
and so on.
The good news: the data comes in in CSV files.
An area where Python shines. We did some code review (his first effort
is impressive -- good use of dictionaries, code which ACTUALLY RUNS!);
everyone had a suggestion or two, everyone learned a thing or two.
(Like csv.DictReader.
class csv.DictReader ...
Create an object which operates like a regular reader but
maps the information read into a dict whose keys are given
by the optional fieldnames parameter [..] the values in
the first row of the csvfile will be used as the fieldnames.
[...]
Wow. A CSV reader which can "know" about which column is firstName,
which column is Addr2, etc. -- you don't have to code lame stuff
like "name = field[3]". Is that neat or what?)
A great meeting!
thanks_to_everyone'ly yrs,
Bill
_______
Sent from my virusproofed Linux PC
More information about the gnhlug-discuss
mailing list