title: retrieve links from web page using python and BeautifulSoup than select 3 link and run it 4 times
body: <p>Here is code.</p>
  
  <pre><code>import urllib
  from BeautifulSoup import *
  
  url = raw_input('Enter - ')
  html = urllib.urlopen(url).read()
  soup = BeautifulSoup(html)
  
  # Retrieve all of the anchor tags
  
  tags = soup('a')
  for tag in tags:
      print tag.get('href', None)
  </code></pre>
  
  <p>There are 18 links. Now need to get position 3 means third link from the output and provide that link as input to html and run it again and do it 4 times. and what ever the last output at the position 3 than print out the name.</p>
  
  <p>[<a href="https://pr4e.dr-chuck.com/tsugi/mod/python-data/data/known_by_Fikret.html][1]" rel="nofollow">https://pr4e.dr-chuck.com/tsugi/mod/python-data/data/known_by_Fikret.html][1]</a></p>
  
  <p>which will return 18 links from the above HTML. Now we need to select the 3 link and provide that 3rd link as an input to 'url' and follow the above loop for 4 times and what ever the last links comes out than get a name like in the first link 'fikret' is the name and what ever in the last link that is our output. Hope this helps. Thank you for looking into it.</p>