我從網(wǎng)站上抓取了 HTMl,需要獲取其中的特定標(biāo)簽,問(wèn)題是,它的格式令人困惑,我無(wú)法獲取整個(gè)標(biāo)簽。讓我舉例說(shuō)明:data = """<div class="Answer">1. BOUNDARIES - EPB & APL <i>(inferior)</i>, EPL <i>(superior). </i><div>2. FLOOR (proximal to distal) - radial styloid => scaphoid => trapezium => 1st MC base. <br /><div>3. CONTENTS - cutaneous branches of radial nerve <i>(on the roof),</i> cephalic vein <i>(begins here),</i> radial artery <i>(on the floor).</i></div></div><div><br /></div><div><img src="paste-27a44c801f0776d91f5f6a16a963bff67f0e8ef3.jpg" /><br /></div><div><b>Image: </b>Case courtesy of Dr Sachintha Hapugoda, <a href="https://radiopaedia.org/">Radiopaedia.org</a>. From the case <a href="https://radiopaedia.org/cases/52525">rID: 52525</a> [Accessed 15 Nov. 2018].</div></div>"""從上面,我只想得到這個(gè):<div><b>Image: </b>Case courtesy of Dr Sachintha Hapugoda, <a href="https://radiopaedia.org/">Radiopaedia.org</a>. From the case <a href="https://radiopaedia.org/cases/52525">rID: 52525</a> [Accessed 15 Nov. 2018].</div>我寫(xiě)了以下代碼:soup = BeautifulSoup(data, "html.parser")image_link = soup.find('div').find('b').next.nextprint(image_link)但它只能讓我得到文本:Case courtesy of Dr Sachintha Hapugoda, <a href="https://radiopaedia.org/">Radiopaedia.org</a>. From the case <a href="https://radiopaedia.org/cases/52525">rID: 52525</a> [Accessed 15 Nov. 2018].我如何獲得整個(gè)標(biāo)簽?
添加回答
舉報(bào)
0/150
提交
取消