>>> type(col)
<class 'bs4.element.Tag'>
>>> col
<td><a href="/english/js/au/">Detail</a></td>
Could someone help me to cleanly extract in python href as a string from the above data? I wan to get the path "/english/js/au/" as string.
>>> type(col)
<class 'bs4.element.Tag'>
>>> col
<td><a href="/english/js/au/">Detail</a></td>
Could someone help me to cleanly extract in python href as a string from the above data? I wan to get the path "/english/js/au/" as string.
This should help you:
href = col.find('a')['href']
print(href)
Output:
/english/js/au/