Apr-28-2020, 05:44 PM
Hi guys,
I am trying to extract specific data from a block of html using Beautiful and attributes and can only get so far.
THe first 3 lines of the html block are:
Any ideas please?
thanks
I am trying to extract specific data from a block of html using Beautiful and attributes and can only get so far.
THe first 3 lines of the html block are:
<div class="pagearrange__layout-column pagearrange__layout-column--full"> <a class="anchor" name="explorers"></a> <div id="explorer_shell_159760" data-tag="41" data-hash-tag="41" data-id="159760" data-aggregating="" data-owner="0" data-userid="0" data-validate="" class="trade_explorer flexBox noflex explorer explorer--demo explorer--loaded">My code is:
response = requests.get(url) content = response.content soup = bs(content,'lxml') ids = soup.find('div', class_ = 'pagearrange__layout-column pagearrange__layout-column--full') print(ids)This finds the correct block of code but I now need to extract values for the element 'data-id'.
Any ideas please?
thanks