Getting concrete attribute within a HTML span tag

Question:

My problem:
I’m using beautiful SOAP in Python, and i want to know how do i get the concrete attribute such as "data-hk".

enter image description here

My code at the moment:
enter image description here

The output of the code is km/L, but i want the data about HK. How do i specifically select the right attribute within the span?

Many thanks in advance.

I tried the above code, and I’ve stated the result and output of it above.

Asked By: cbs-student

||

Answers:

Try this:

HK = cars.find("span", class_="variableDataColumn")["data-hk"]
Answered By: baduker