0
我該如何去獲取標籤下的值?我期待在python中使用BeautifulSoup4返回'-6.43798'。用BS4解析XML文件
<html><body><maggridresult>
<version>
0.5.0.7
</version>
<result>
<date>
2017.07671
</date>
<latitude units="degree">
42.26042
</latitude>
<longitude units="degree">
-84.46044
</longitude>
<elevation units="km">
0.00000
</elevation>
<declination units="degree">
-6.43798
</declination>
<declination_sv units="degree">
-0.03752
</declination_sv>
<declination_uncertainty units="degree">
0.37303
</declination_uncertainty>
</result>
</maggridresult>
</body></html>
我認爲它與查找或找到所有功能有關,但我不知道具體如何實現它。
謝謝!
'soup.find('declination')。text' – furas