BeautifulSoup爬虫

来源:互联网 发布:网络监察大队报名 编辑:程序博客网 时间:2024/05/16 08:49
在csdn首页上查看脚本时看到这么一句话:
<meta content="GzEltai8cI" name="baidu-site-verification"/>

想打印出其中的name

我是这样做的:

import requests

from bs4 import  BeautifulSoup

soup = BeautifulSoup(requests.get("http://www.csdn.net/",'lxml'))

print(soup.find("meta",{"content":"GzEltai8cI "})['name'])


编辑环境:python3+ jupyter



原创粉丝点击