s = (
    '<div class="question" id="get attrs" name="python" x="something">Hello World</div>'
    )
soup = BeautifulSoup(s)
attributes_dictionary = soup.find('div').attrs
print(attributes_dictionary)
print(attributes_dictionary['class'][0])
print(soup.find('div').get_text())
Python: BeautifulSoup - get an attribute value based on the name attribute