[Tutor] understanding urllib.urlopen
bob gailer
bgailer at gmail.com
Thu Apr 23 23:41:49 CEST 2009
johnf wrote:
> I'm trying to comfirm an address is a good address via google. Meaning does
> google report that the address exist.
>
> If I do
> urllib.urlopen( "http://maps.google.com/maps/geo?%s" % params )
> with the address in params. I get the longitude and latitude correctly.
>
> If I use the following in the address bar of a browser
> "http://maps.google.com?q='18 Tadlock Place Woodland CA'"
> all works.
>
> But if I attempt this
> urllib.urlopen( "http://maps.google.com?q='18 Tadlock Place Woodland CA'" )
> it always fails.
>
> So I don't understand urllib.urlopen(). Could some kind soul explain what I'm
> doing wrong.
>
1) put a / after .com
2) encode it (in this case that means replace blanks with %20)
x=urllib.urlopen("http://maps.google.com/?q=18%20Tadlock%20Place%20Woodland%20CA")
--
Bob Gailer
Chapel Hill NC
919-636-4239
More information about the Tutor
mailing list