fork download
  1. import urllib
  2. #import urllib.request
  3. #import urllib.response
  4. #import urllib.error
  5. #from BeautifulSoup import BeautifulSoup
  6. # or if your're using BeautifulSoup4:
  7. from bs4 import BeautifulSoup
  8. count = 0
  9. s = urllib.urlopen('http://w...content-available-to-author-only...y.in/sch/i.html?_trksid=p3907.m570.l1313&_nkw=&_sacat=15032&_from=R40')
  10. soup = BeautifulSoup((s).read())
  11. #imgs=soup.findall('td')
  12. #print imgs.contents[4]
  13. #for feature_heading in soup.find_all("td", {"class": "Feature-Heading"}):
  14. #while soup.find("table"):
  15. for row in soup.findAll("table", {"class" : "li rsittlref"}):#[0].tbody('tr'):
  16. tds = row('td')
  17. test= tds[0]
  18. count= count + 1
  19. for link in test.findAll("a"):
  20. new_link = link['href']
  21. tem_link = urllib.request.urlopen(new_link)
  22. soup1 = BeautifulSoup((tem_link).read())
  23. for row_link in soup1.findAll("div", {"class" : "mbg"}):
  24. var = row_link('a')
  25. st = var[0]
  26.  
Runtime error #stdin #stdout #stderr 0.08s 119680KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 9, in <module>
AttributeError: module 'urllib' has no attribute 'urlopen'