jarrod817
12/12/2015 - 4:00 AM

Coursera - Go to social network site and click on the 17th item 7 times.

Coursera - Go to social network site and click on the 17th item 7 times.

import urllib
import re
from bs4 import BeautifulSoup

number = list()
count = 1

def linkgen (link):
    soup = BeautifulSoup(urllib.urlopen(link).read())
    tags = soup('a')
    link3 = tags[17].get('href', None)
    return link3

link = raw_input('Enter - ')

while count <= 7:
    link = linkgen(link)
    count = count + 1
    name = re.findall('_([A-Za-z]+).html', link)
    print name