The CSS selector syntax "element.class[attribute=value]" does not work.
I know the BeautifulSoup docs say that it only provides a subset of CSS selectors, but it would be really great if it supported such multi-level ones!
The code below illustrates, with theSpan2 not working (I am using BS version 4.6.0).
import bs4
myHTML = """
<html>
<head>
<style type="text/css">
.theSpan[data-value=spanner] { background-color: grey; }
</style>
</head>
<body>
Here is
<span class="theSpan" data-value="spanner">SPAN</span>
</body>
</html>
"""
soup = bs4.BeautifulSoup(myHTML, "html.parser")
theSpan1 = soup.select('span.theSpan')
theSpan2 = soup.select('span.theSpan[data-value=spanner]')
theSpan3 = soup.select('span[data-value=spanner]')
print("theSpan1 matched", len(theSpan1), "item:", theSpan1)
print("theSpan2 matched", len(theSpan2), "item:", theSpan2)
print("theSpan3 matched", len(theSpan3), "item:", theSpan3)