【发布时间】:2017-07-26 03:45:44
【问题描述】:
我不断收到错误消息“缺少 1 个必需的位置参数:'section_url'”
每次我尝试使用 findall 时都会收到此错误。
刚开始学习python,所以任何帮助都将不胜感激!
from bs4 import BeautifulSoup
import urllib3
def extract_data():
BASE_URL = "http://www.chicagotribune.com/dining/ct-chicago-rooftops-patios-eat-drink-outdoors-near-me-story.html"
http = urllib3.PoolManager()
r = http.request('GET', 'http://www.chicagotribune.com/dining/ct-chicago-rooftops-patios-eat-drink-outdoors-near-me-story.html')
soup = BeautifulSoup(r.data, 'html.parser')
heading = soup.find("div", "strong")
category_links = [BASE_URL + p.a['href'] for p in heading.findAll('p')]
return category_links
print(soup)
extract_data()
【问题讨论】:
标签: python python-3.x web-scraping beautifulsoup web-crawler