Trying to extract text from a tag based on href
containing a certain string, below is part of my sample code:
Experience = soup.find_all(id='background-experience-container')
Exp = {}
for element in Experience:
Exp['Experience'] = {}
for element in Experience:
role = element.find(href=re.compile("title").get_text()
Exp['Experience']["Role"] = role
for element in Experience:
company = element.find(href=re.compile("exp-company-name").get_text()
Exp['Experience']['Company'] = company
It doesn't like the syntax for how I've defined the Exp['outer_key']['inner_key'] = value
it is returning SyntaxError
.
I'm trying to buld a Dict.dict
which contains info on role and company, will also look to include dates for each but haven't got that far yet.
Can anyone spot any glaringly obvious mistakes in my code?
Really appreciate any help with this!