Python 美丽的汤:无法从中获取文本(价格)

Python 美丽的汤:无法从中获取文本(价格),python,html,python-3.x,beautifulsoup,Python,Html,Python 3.x,Beautifulsoup,[ 我怎样才能从这乱七八糟的局面中得到价格。] <li class="price-current"> <span class="price-current-label"> </span>₹ 36,659 <a class="price-current-num" href="https://www.newegg.com/global/in-en/gigabyte-geforce-rtx-2070-

[ 我怎样才能从这乱七八糟的局面中得到价格。]

<li class="price-current">
               <span class="price-current-label">
               </span>₹ 36,659 <a class="price-current-num" href="https://www.newegg.com/global/in-en/gigabyte-geforce-rtx-2070-super-gv-n207swf3oc-8gd/p/N82E16814932213?Item=N82E16814932213&amp;buyingoptions=New">(3 Offers)</a>
               <span class="price-current-range">
               <abbr title="to">–</abbr>
               </span>
 </li>
您可以使用.find_next_sibling with text=True参数查找价格:

data = '''<li class="price-current">
               <span class="price-current-label">
               </span>₹ 36,659 <a class="price-current-num" href="https://www.newegg.com/global/in-en/gigabyte-geforce-rtx-2070-super-gv-n207swf3oc-8gd/p/N82E16814932213?Item=N82E16814932213&amp;buyingoptions=New">(3 Offers)</a>
               <span class="price-current-range">
               <abbr title="to">–</abbr>
               </span>
 </li>'''

from bs4 import BeautifulSoup

soup = BeautifulSoup(data, 'html.parser')

print(soup.select_one('.price-current-label').find_next_sibling(text=True))

请不要将HTML代码作为图像发布。编辑你的问题并将其作为文本放在那里。这样我们就可以复制它并尝试找到解决方案。好的!感谢您的建议。如果您在浏览器中搜索HTML中的Python get字段,您将找到比我们在这里能够更好地解释这一点的参考资料。我们希望您在这里发布之前进行基本搜索。非常感谢。我真的很感激。
₹ 36,659