title: Following links in python assignment using Beautifulsoup
body: <p>I have this assignment for a python class where I have to start from a specific link at a specific position, then follow that link for a specific number of times. Supposedly the first link has the position 1.
  This is the link: <a href="http://python-data.dr-chuck.net/known_by_Fikret.html" rel="nofollow">http://python-data.dr-chuck.net/known_by_Fikret.html</a></p>
  
  <p><a href="http://i.stack.imgur.com/DLiCN.png" rel="nofollow">traceback error picture</a>
  I have trouble with locating the link, the error "index out of range" comes out. can anyone help with figuring out how to locate the link/position? This is my code:</p>
  
  <pre><code>import urllib
  from BeautifulSoup import *
  
  url = raw_input('Enter - ')
  html = urllib.urlopen(url).read()
  soup = BeautifulSoup(html)
  count = int(raw_input('Enter count: '))+1
  position = int(raw_input('Enter position: '))
  
  
  tags = soup('a')
  tags_lst = list()
  for tag in tags:
      needed_tag = tag.get('href', None)
      tags_lst.append(needed_tag)
      for i in range(0,count):
          print 'retrieving: ',tags_lst[position]
  </code></pre>
  
  <p>OK I wrote this code and it kind of works:</p>
  
  <pre><code>import urllib
  from BeautifulSoup import *
  
  url = raw_input('Enter - ')
  html = urllib.urlopen(url).read()
  soup = BeautifulSoup(html)
  count = int(raw_input('Enter count: '))+1
  position = int(raw_input('Enter position: '))
  
  
  tags = soup('a')
  tags_lst = list()
  for tag in tags:
      needed_tag = tag.get('href', None)
      tags_lst.append(needed_tag)
  for i in range(0,count):    
      print 'retrieving: ',tags_lst[position]
      position = position + 1
  </code></pre>
  
  <p>I'm still getting other links than the ones in the example however when I print the whole list of links the positions match so I don't know. Very weird.</p>