>>> from bs4 import BeautifulSoup
>>> soup = BeautifulSoup('<p class="someclass">inner text</p>')
>>> attr = soup.p['class']
>>> print(attr)
['someclass']
Per the docs, shouldn't the variable attr contain a plain string, 'someclass', rather than a list?
Strangely, when I try the code above replacing the input with <a href="somehref">inner text</a>, the attribute returns a string as expected.
However, <a class="someclass">inner text</a> returns a list.
I searched several times trying to find others having the same issue, but couldn't find anything. Apologies if this is a well-known issue.
Using version 4.5.3 inside a virtualenv.