the html code is like this:
<div class="AAA">Text of AAA<a href="......AAA/url">Display text of URL A</a></div>
<div class="BBB">Text of BBB<a href="......BBB/url">Display text of URL B</a></div>
<div class="CCC">Text of CCC</div>
<div class="DDD">Text of DDD</div>
I want to parse the text for all the div, while check if there is url exist, if yes then also extract it out and display in output
output like this:
Text of AAA
Display text of URL A
......AAA/url
Text of BBB
Display text of URL B
......BBB/url
Text of CCC
Text of DDD
i tried to nest the loop of find_all('a') within find_all('div') loop, but messed up my output