スクレイピングを行うための簡単なプログラムを Python で作成しました。私はこれに非常に慣れていません。bs4のドキュメントで提供されていることを理解できません
from bs4 import BeautifulSoup
import urllib2
url="http://www.99acres.com/property-in-velachery-chennai-south-ffid?"
page=urllib2.urlopen(url)
soup = BeautifulSoup(page.read())
properties=soup.findAll('a',{'class':'f15'})
for eachproperty in properties:
print eachproperty['href']+","+eachproperty.string
次のエラーが表示されます
/Residential-Apartment-Flat-in-Velachery-Chennai South-2-Bedroom-bhk-for-Sale-spid-Y10765227,2 Bedroom, Residential Apartment in Velachery
Traceback (most recent call last):
File "properties.py", line 8, in <module>
print eachproperty['href']+","+eachproperty.string
TypeError: cannot concatenate 'str' and 'NoneType' objects