我不断收到错误‘失踪1个人需要位置参数:‘section_url’’的findall错误 - NoneType”对象有没有属性‘的findall’
我每次尝试的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()
非常感谢你的回答是什么!我尝试过,但不幸的是仍然有相同的错误。每次我尝试使用findAll,我得到这个错误。 –