python爬取页面上的链接

python爬取豆瓣网上的链接

import urllib
from bs4 import BeautifulSoup
response = urllib.urlopen('https://www.douban.com/')
bsObj = BeautifulSoup(response, 'html.parser')
a = bsObj.find_all('a')
for b in a:
    c = b.get('href')
    print(c)

发布了36 篇原创文章 · 获赞 24 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/admins_/article/details/86670653
今日推荐