BeautifulSoup - extracting attribute values

后端 未结 2 1348
一整个雨季
一整个雨季 2020-11-29 12:12

If Beautiful Soup gives me an anchor tag like this:


How would I

相关标签:
2条回答
  • 2020-11-29 12:47
    link.get('href')
    

    in which 'link' is the name of your 'a' tag

    0 讨论(0)
  • 2020-11-29 12:57

    If you already have the anchor, grab the href attribute like this:

    href = anchor["href"]
    
    0 讨论(0)
提交回复
热议问题