我试图从当地网站上获取并打印当前的天气温度和城市名称,但没有成功。 我只需要它来阅读和打印城市(Lodrina),温度(23.1C),如果可能的话,标题是冷杉(“Temperatura em declínio”)—最后一个随着温度的上升或下降而变化。。。在
网站的html部分是:
THIS IS THE HTML (the part of matters:)
#<div class="ca-cidade"><a href="/site/internas/conteudo/meteorologia/grafico.shtml?id=23185109">Londrina</a></div>
<ul class="ca-condicoes">
<li class="ca-cond-firs"><img src="/site/imagens/icones_condicoes/temperatura/temp_baixa.png" title="Temperatura em declínio"/><br/>23.1°C</li>
<li class="ca-cond"><img src="/site/imagens/icones_condicoes/vento/L.png"/><br/>10 km/h</li>
<li class="ca-cond"><div class="ur">UR</div><br/>54%</li>
<li class="ca-cond"><img src="/site/imagens/icones_condicoes/chuva.png"/><br/>0.0 mm</li>
有什么帮助吗?在
下面的代码可以得到详细的温度在页面的右侧,如您所需。在
^{pr2}$你应该试试BS4中的CSS3选择器,我个人觉得它比find and find-all要容易得多。在
我不知道你的代码遇到了什么问题。在我尝试使用您的代码时,我发现我需要使用html解析器来成功解析网站。我也用过芬德尔汤()以查找与所需类匹配的元素。希望下面的内容能让你找到答案:
相关问题 更多 >
编程相关推荐