I am trying to scrape the data from a website using beautiful soup4 and python. Here is my code
from bs4 import BeautifulSoup
import urllib2
i = 0
for i in xrange(0,38):
page=urllib2.urlopen("http://www.sfap.org/klsfaprep_search?page={}&type=1&strname=&loc=&op=Lancer%20la%20recherche&form_build_id=form-72a297de309517ed5a2c28af7ed15208&form_id=klsfaprep_search_form" %i)
soup = BeautifulSoup(page.read())
for eachuniversity in soup.findAll('div',{'class':'field-item odd'}):
print ''.join(eachuniversity.findAll(text=True)).encode('utf-8')
print ',\n'
i= i+ 1
I think the problem is in the URL that I have given and in the increment statement. I am able to scrape page by page. But only when I give the xrange.