Beautiful Soup: Accessing
  • elements from
      with no id
  • 后端 未结 2 765
    遥遥无期
    遥遥无期 2021-01-15 14:32

    I am trying to scrape the people who have birthdays from this Wikipedia page

    Here is the existing code:

    hdr = {\'User-Agent\': \'Mozilla/5.0\'}
    site          
    
    
            
    2条回答
    •  情话喂你
      2021-01-15 15:11

      Find the Births section:

      section = soup.find('span', id='Births').parent
      

      And then find the next unordered list:

      births = section.find_next('ul').find_all('li')
      

    提交回复
    热议问题