url = 'http://www.zillow.com/homedetails/3728-Balcary-Bay-Champaign-IL-61822/89057727_zpid/'
page = urllib2.urlopen(url)
soup = BeautifulSoup(page)
info = soup.findAll('span',{'itemtype':'http://schema.org/GeoCoordinates'}) #this tag + class combination found 4 matches, 4th one was the required one, just selecting that here
for form in info:
b= form.find('meta')['content']
print b
This is the snapshot of the code i am using to get the latitude and longitude information from Zillow. I can pin point the code where the latitude and longitude information is stored using span and itemtype. The place where I am parsing this data from has a code similar to the one below:
<span itemprop="geo" itemscope="" itemtype="http://schema.org/GeoCoordinates">
<meta content="40.12938" itemprop="latitude">
<meta content="-88.30766" itemprop="longitude">
</span>
I am able to get the latitude information but unable to get the longitude information. Can someone help me in getting this information?
Output of the code:
>>> ================================ RESTART ================================
>>>
40.12938
>>>
Intended output:
>>> ================================ RESTART ================================
>>>
40.12938 -88.30766
>>>