有人可以帮助我如何在此代码中获得“结束”的价值。我在这里使用beautifulsoup。
<div class="number" color="secondary" data-reactid="72" end="4269" start="0" style="display:flex;align-content:space-between;font-size:1.6rem;line-height:2.2399999999999998rem;color:rgb(130, 130, 130);">0</div>
答案 0 :(得分:1)
使用键值访问元素。您的密钥是属性名称。
<强>实施例强>
Sub Rotate()
With ActiveWindow.Selection.ShapeRange
.IncrementRotation 2
End With
End Sub
<强>输出:强>
from bs4 import BeautifulSoup
s = """<div class="number" color="secondary" data-reactid="72" end="4269" start="0" style="display:flex;align-content:space-between;font-size:1.6rem;line-height:2.2399999999999998rem;color:rgb(130, 130, 130);">0</div>"""
soup = BeautifulSoup(s, "html.parser")
print(soup.div["end"])
答案 1 :(得分:0)
假设您的HTML已被吸入soup
:
soup.div [&#39;端&#39;]