Обращение к словарю
Как мне обратиться к массиву словаря(result_list) с ключом href, about? Ну то есть мне надо достать первый элемент массива из словаря, с ключевым словом href и аналогично с другими ключевыми словами
# This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
from bs4 import BeautifulSoup as bs
import requests
import pandas as pd
URL_Template = "https://www.work.ua/ru/jobs-odesa/?page=2"
r = requests.get(URL_Template)
#print(r.status_code)
#print(r.text)
soup = bs(r.text, "html.parser")
vacancies_names = soup.find_all('h2', class_='')
vacancies_info = soup.find_all('p', class_='overflow text-muted add-top-sm cut-bottom')
result_list = {'href': [], 'title': [], 'about': []}
try:
for i in range(2):
for info in vacancies_info:
result_list['about'].append(info.text)
for name in vacancies_names:
print()
result_list['title'].append(name.a['title'])
result_list['href'].append(f"https://www.work.ua{name.a['href']}")
except:
print(r"TypeError: 'NoneType' object is not subscriptable")
print(result_list)