如何在python中使用嵌套字典?

如何在python中使用嵌套字典?,python,csv,email,dictionary,Python,Csv,Email,Dictionary,我正在尝试使用Hunter.io API编写一些代码,以自动化一些b2b电子邮件抓取。我已经很久没有写任何代码了,我需要一些输入。我有一个URL的CSV文件,我想在每个URL上调用一个函数,输出一个字典,如下所示: `{'domain': 'fromthebachrow.com', 'webmail': False, 'pattern': '{f}{last}', 'organization': None, 'emails': [{'value': 'fbach@fromthebachrow.c

我正在尝试使用Hunter.io API编写一些代码,以自动化一些b2b电子邮件抓取。我已经很久没有写任何代码了,我需要一些输入。我有一个URL的CSV文件,我想在每个URL上调用一个函数,输出一个字典,如下所示:

`{'domain': 'fromthebachrow.com', 'webmail': False, 'pattern': '{f}{last}', 'organization': None, 'emails': [{'value': 'fbach@fromthebachrow.com', 'type': 'personal', 'confidence': 91, 'sources': [{'domain': 'fromthebachrow.com', 'uri': 'http://fromthebachrow.com/contact', 'extracted_on': '2017-07-01'}], 'first_name': None, 'last_name': None, 'position': None, 'linkedin': None, 'twitter': None, 'phone_number': None}]}`    
对于我调用函数的每个URL。我希望我的代码只返回标记为“value”的每个键的电子邮件地址

值是包含在列表中的键,该列表本身是my function输出目录的元素。我可以访问输出字典以获取键入“电子邮件”的列表,但我不知道如何访问列表中包含的字典。我想让我的代码返回字典中用“value”键输入的值,我想让它对我所有的URL都这样做

from pyhunyrt import PyHunter  
import csv  
file=open('urls.csv')  
reader=cvs.reader (file)  
urls=list(reader)  
hunter=PyHunter('API Key')  
for item in urls:      
 output=hunter.domain_search(item)
 output['emails'`
它为每个项目返回如下列表:

 [{
    'value': 'fbach@fromthebachrow.com',
    'type': 'personal',
    'confidence': 91,
    'sources': [{
      'domain': 'fromthebachrow.com',
      'uri': 'http://fromthebachrow.com/contact',
      'extracted_on': '2017-07-01'
    }], 
    'first_name': None,
    'last_name': None,
    'position': None,
    'linkedin': None, 
    'twitter': None,
    'phone_number': None
  }]
如何获取该列表中的第一个字典,然后访问与“value”配对的电子邮件,以便我的输出仅是最初输入的每个url的电子邮件地址

要获取列表中的第一个dict(或任何项),请使用
list[0]
,然后使用
[“value”]
获取键的值。要组合它,您应该使用
list[0][“value”]