I have links looks like this
<div class="systemRequirementsMainBox">
<div class="systemRequirementsRamContent">
<span title="000 Plus Minimum RAM Requirement">1 GB</span> </div>
I'm trying to get 1 GB
from there. I tried
tt = [a['title'] for a in soup.select(".systemRequirementsRamContent span")]
for ram in tt:
if "RAM" in ram.split():
print (soup.string)
It outputs None
.
I tried a['text']
but it gives me KeyError. How can I fix this and what is my mistake?
You can use a css selector, pulling the span you want using the title text :
That finds the span with a title attribute that contains RAM, it is equivalent to saying in python,
if "RAM" in span["title"]
.Or using find with re.compile
To get all the data:
Which will give you: