Skip to main content
1 of 2

Building on @Dex'ter answer, I think that using a dictionary to store your results call for the wrong iteration patterns. I would store them in a list and grab them directly with a for loop when I need them.

Building becomes something along the lines of:

vacancies = [{
    'position': element.contents[0].strip(),
    'link': 'http://rabota.ua{}'.format(element.get('href')),
} for element in href_tag]

Updating would be:

for vacancy, company in zip(vacancies, company_href):
    vacancy.update({'company': company.get_text()})

And printing can be as simple as:

for vacancy in vacancies:
    print(vacancy['company'], vacancy['position'], vacancy['link'], sep='\n')

Writting that, I think that using the whole building + updating technique is also a poor decision as you could build everything at once:

href_tag = content.find_all('a', class_='t')
company_href_tag = content.find_all("a", class_="rua-p-c-default")[2:]

vacancies = [{
    'position': element.contents[0].strip(),
    'link': 'http://rabota.ua{}'.format(element.get('href')),
    'company': company.get_text(),
} for element, company in zip(href_tag, company_href_tag)]