python Coursera - 访问社交网站并点击第17项7次。

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python Coursera - 访问社交网站并点击第17项7次。相关的知识,希望对你有一定的参考价值。

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

以上是关于python Coursera - 访问社交网站并点击第17项7次。的主要内容,如果未能解决你的问题,请参考以下文章