python语言的官方网站地址-字符串中的街道地址搜索-Python或Ruby

?s=32Tyson

也许你想看看pypostal。pyposal是对libposal的正式Python绑定。

我举了迈克·贝萨尼的例子:from postal.parser import parse_address

addresses = [

"420 Fanboy Lane, Cupertino CA 12345",

"1829 William Tell Oveture, by Gioachino Rossini 88421",

"114801 Western East Avenue Apt. B32, Funky Township CA 12345",

"1 Infinite Loop, Cupertino CA 12345-1234",

"420 time!",

]

for address in addresses:

print parse_address(address)

print "*" * 60

> [(u'420', u'house_number'), (u'fanboy lane', u'road'), (u'cupertino', u'city'), (u'ca', u'state'), (u'12345', u'postcode')]

> ************************************************************

> [(u'1829', u'house_number'), (u'william tell', u'road'), (u'oveture by gioachino', u'house'), (u'rossini', u'road'), (u'88421',

> u'postcode')]

> ************************************************************

> [(u'114801', u'house_number'), (u'western east avenue apt.', u'road'), (u'b32', u'postcode'), (u'funky', u'road'), (u'township',

> u'city'), (u'ca', u'state'), (u'12345', u'postcode')]

> ************************************************************

> [(u'1', u'house_number'), (u'infinite loop', u'road'), (u'cupertino', u'city'), (u'ca', u'state'), (u'12345-1234',

> u'postcode')]

> ************************************************************

> [(u'420', u'house_number'), (u'time !', u'house')]

> ************************************************************

赞踩评论- 2020年3月31日 14:43

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值