Christopher Spears wrote:
> One of the exercises in Core Python Programming is to
> create a regular expression that will match a street
> address. Here is one of my attempts.
>
street = "1180 Bordeaux Drive"
patt = "\d+ \w+"
import re
m = re.match(patt, street)
if m is
"Christopher Spears" <[EMAIL PROTECTED]> wrote
> create a regular expression that will match a street
> address. Here is one of my attempts.
>
> Obviously, I can just create a pattern "\d+ \w+ \w+".
> However, the pattern would be useless if I had a
> street name like 3120 De la Cruz Boulevard
On 04/10/2007, Christopher Spears <[EMAIL PROTECTED]> wrote:
> Obviously, I can just create a pattern "\d+ \w+ \w+".
> However, the pattern would be useless if I had a
> street name like 3120 De la Cruz Boulevard. Any
> hints?
Possibly you could create a list of street types ('Street', 'Road',
'C
One of the exercises in Core Python Programming is to
create a regular expression that will match a street
address. Here is one of my attempts.
>>> street = "1180 Bordeaux Drive"
>>> patt = "\d+ \w+"
>>> import re
>>> m = re.match(patt, street)
>>> if m is not None: m.group()
...
'1180 Bordeaux'