I have the following HTML snippet output stored in variable named content of type bs4.element.Tag.
<li class="item">
Alpha-tocopherol
<em>see</em>
<a href="https://medlineplus.gov/vitamine.html">Vitamin E</a>
</li>
str(content) output:
'<li class="item">\n Alpha-tocopherol\n <em>see</em>\n<a href="https://medlineplus.gov/vitamine.html">Vitamin E</a>\n</li>'
I would like to use Python to get as output: ['Alpha-tocopherol', 'Vitamin E'].
I tried the following but it is wrong:
regex = re.compile('(\w+\s+)\n')
regex.sub('', content.text).split()