python 抓取页面URL和标题

  import requests
import re

# 获取html文档
def get_html(url):

    response = requests.get(url)
    response.encoding = 'utf-8'
    return response.text


# 获取笑话



url_joke = "http://wapjin.com"

html = get_html(url_joke)

c = re.findall('<a href="(.*?)>(.*?)</a>',html,re.S)

print(c)

评论

刷新

友情链接