newbie question: parsing street name from address
Bell, Kevin
kevin.bell at slcgov.com
Thu Jun 21 11:20:52 EDT 2007
Look at the string.split() built-in, then you could use s.isalpha &
s.isdigit to test each word... regular expressions would be the way to
go, but that's a bit to chew on if you're getting started with string
methods. You'll need to look at list indexing as well.
Kev
SLC DOT GIS
-----Original Message-----
From: python-list-bounces+kevin.bell=slcgov.com at python.org
[mailto:python-list-bounces+kevin.bell=slcgov.com at python.org] On Behalf
Of cjl
Sent: Thursday, June 21, 2007 7:47 AM
To: python-list at python.org
Subject: newbie question: parsing street name from address
P:
I am working on a project that requires geocoding, and have written a
very simple geocoder that uses the Google service.
I would like to be able to extract the name of the street from the
addresses in my data, however they vary significantly. Here a some
examples:
25 Main St
2500 14th St
12 Bennet Pkwy
Pearl St
Bennet Rd and Main st
19th St
As you can see, sometimes I have the house number, and sometimes I do
not. Sometimes the street name is a number. Sometimes I simply have
the names of intersecting streets.
I would like to be able to parse the above into the following:
Main St
14th St
Bennet Pkwy
Pearl St
Bennet Rd
Main St
19th St
How might I approach this complex parsing problem?
-CJL
--
http://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list