【发布时间】:2017-06-21 16:03:12
【问题描述】:
我现在正在研究网络爬虫,似乎我无法从特定网站获取 div 内的类。下面是我的代码。我在 Python3 中使用 BeautifulSoup
import requests
from bs4 import BeautifulSoup as bs
response = requests.get('https://e27.co/startup/flipkart').text
soup = bs(response, 'html.parser')
content_div = soup.findAll('h1',class_ = 'profile-startup')
print(content_div)
我想提取 h1 中具有“profile-startup”类的文本。上面的代码什么也不返回。你们能帮帮我吗?
【问题讨论】:
标签: python html python-3.x beautifulsoup web-crawler