Get value of span tag using BeautifulSoup

前端 未结 4 2131
滥情空心
滥情空心 2021-02-20 11:47

I have a number of facebook groups that I would like to get the count of the members of. An example would be this group: https://www.facebook.com/groups/347805588637627/ I have

4条回答
  •  天涯浪人
    2021-02-20 12:10

    If you have more than one span tag you can try this

    from bs4 import BeautifulSoup
    
    soup = BeautifulSoup(html, 'html.parser')
    
    tags = soup('span')
    
    for tag in tags:
      print(tag.contents[0])
    

提交回复
热议问题