from selenium import webdriver
import time
import requests
from bs4 import BeautifulSoup as bs
driver = webdriver.Firefox()
url = “http://china.huanqiu.com/article/2016-07/9132061.html?from=bdwz”
driver.get(url)
response = bs(requests.get(url).content, ‘html.parser’)
获取页面内,h1标签的文章标题
print(u"这篇文章的标题是:", response.h1.string)
使用find方法,寻找页面内name=source的content的内容
print (u"这篇文章的类型是:", response.find(attrs={‘name’: ‘source’})[‘content’])
从find_all返回的列表中,查找content字段
for content in response.find_all(‘meta’, {‘name’: ‘source’}):
print(u"这篇文章的类型是:", content[‘content’])
如果你也是看准了Python,想自学Python,在这里为大家准备了丰厚的免费**学习**大礼包,带大家一起学习,给大家剖析Python兼职、就业行情前景的这些事儿。
### 一、Pyth