python - findall error - NoneType' object has no attribute 'findall' -


i keep getting error "missing 1 required positional argument: 'section_url'"

every time try working findall error.

new learning python appreciated!

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'] p in heading.findall('p')]     return category_links     print(soup)   extract_data() 

building on accepted answer's answer, think want

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.select('div strong')     print(heading)     category_links = [base_url + p.a['href'] p in [i i, x in enumerate(heading) if x == "p"]]     return category_links   print(extract_data()) 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -