Requiring help in figuring out indent error in python code
Question: I get an indentation error when trying to run the code below. I am trying to
print out the URLs of a set of html pages recursively.

    
    
    import urllib2
    from BeautifulSoup import *
    from urlparse import urljoin
    # Create a list of words to ignore
    ignorewords=set(['the','of','to','and','a','in','is','it'])
    
    def crawl(self,pages,depth=2):
    for i in range(depth):
    newpages=set()
    for page in pages:
    try:
    c=urllib2.urlopen(page)
    except:
    print "Could not open %s" % page
    continue
    soup=BeautifulSoup(c.read())
    self.addtoindex(page,soup)
    links=soup('a')
    for link in links:
    if ('href' in dict(link.attrs)):
    url=urljoin(page,link['href'])
    if url.find("'")!=-1: continue
    url=url.split('#')[0] # remove location portion
    if url[0:4]=='http' and not self.isindexed(url):
    newpages.add(url)
    linkText=self.gettextonly(link)
    self.addlinkref(page,url,linkText)
    self.dbcommit()
    pages=newpages
    


Answer: Well you're coded is totally unindented so Python will cry when you try and
run it.

Remember in Python whitespace is important. Indenting with 4 spaces rather
than tab saves a lot of "invisible" indentation errors.

I've down-voted as the code was pasted unformatted/unindented which means
either the poster doesn't understand python (and hasn't read a basic tutorial)
or pasted the code without re-indenting , which makes it impossible for anyone
to answer.

