Answer the question
In order to leave comments, you need to log in
How to get the value from the tag?
<tr class="img weatherIcoS"> <td class="p1"> <div class="weatherIco n000" title="Ясно"><img alt="" class="weatherImg" src="//sinst.fwdcdn.com/img/weatherImg/s/n000.gif"/></div> </td> <td class="p2 bR"> <div class="weatherIco n000" title="Ясно"><img alt="" class="weatherImg" src="//sinst.fwdcdn.com/img/weatherImg/s/n000.gif"/></div> </td> <td class="p3"> <div class="weatherIco d300" title="Облачно с прояснениями"><img alt="" class="weatherImg" src="//sinst.fwdcdn.com/img/weatherImg/s/d300.gif"/></div> </td> <td class="p4 bR"> <div class="weatherIco d300" title="Облачно с прояснениями"><img alt="" class="weatherImg" src="//sinst.fwdcdn.com/img/weatherImg/s/d300.gif"/></div> </td> <td class="p5 cur"> <div class="weatherIco d300" title="Облачно с прояснениями"><img alt="" class="weatherImg" src="//sinst.fwdcdn.com/img/weatherImg/s/d300.gif"/></div> </td> <td class="p6 bR"> <div class="weatherIco d320" title="Облачно с прояснениями, дождь"><img alt="" class="weatherImg" src="//sinst.fwdcdn.com/img/weatherImg/s/d320.gif"/></div> </td> <td class="p7"> <div class="weatherIco d320" title="Облачно с прояснениями, дождь"><img alt="" class="weatherImg" src="//sinst.fwdcdn.com/img/weatherImg/s/d320.gif"/></div> </td> <td class="p8"> <div class="weatherIco n300" title="Облачно с прояснениями"><img alt="" class="weatherImg" src="//sinst.fwdcdn.com/img/weatherImg/s/n300.gif"/></div> </td> </tr>
Answer the question
In order to leave comments, you need to log in
Regular Expressions
import re
str = '<tr class="img weatherIcoS"> <td class="p1"> <div class="weatherIco n000" title="Ясно"><img alt="" class="weatherImg" src="//sinst.fwdcdn.com/img/weatherImg/s/n000.gif"/></div> </td> <td class="p2 bR"> <div class="weatherIco n000" title="Ясно"><img alt="" class="weatherImg" src="//sinst.fwdcdn.com/img/weatherImg/s/n000.gif"/></div> </td> <td class="p3"> <div class="weatherIco d300" title="Облачно с прояснениями"><img alt="" class="weatherImg" src="//sinst.fwdcdn.com/img/weatherImg/s/d300.gif"/></div> </td> <td class="p4 bR"> <div class="weatherIco d300" title="Облачно с прояснениями"><img alt="" class="weatherImg" src="//sinst.fwdcdn.com/img/weatherImg/s/d300.gif"/></div> </td> <td class="p5 cur"> <div class="weatherIco d300" title="Облачно с прояснениями"><img alt="" class="weatherImg" src="//sinst.fwdcdn.com/img/weatherImg/s/d300.gif"/></div> </td> <td class="p6 bR"> <div class="weatherIco d320" title="Облачно с прояснениями, дождь"><img alt="" class="weatherImg" src="//sinst.fwdcdn.com/img/weatherImg/s/d320.gif"/></div> </td> <td class="p7"> <div class="weatherIco d320" title="Облачно с прояснениями, дождь"><img alt="" class="weatherImg" src="//sinst.fwdcdn.com/img/weatherImg/s/d320.gif"/></div> </td> <td class="p8"> <div class="weatherIco n300" title="Облачно с прояснениями"><img alt="" class="weatherImg" src="//sinst.fwdcdn.com/img/weatherImg/s/n300.gif"/></div> </td> </tr>'
titles = re.findall(r'title="([^"]*)"', str)
print(titles) // ['Ясно', 'Ясно', 'Облачно с прояснениями', 'Облачно с прояснениями', 'Облачно с прояснениями', 'Облачно с прояснениями
, дождь', 'Облачно с прояснениями, дождь', 'Облачно с прояснениями']
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question