Форум сайта python.su
0
Здравствуйте
У меня есть словарь, но что-то сложновато мне понять как достать данные с него.
Подскажите пожалуйста для примера как мне достать хотя бы накоторые самые спрятаные values с keys выделенные жирным
{'_links': [{'href': 'https://us10.api.mailchimp.com/3.0/reports',
‘method’: ‘GET’,
‘rel’: ‘parent’,
‘schema’: 'https://us10.api.mailchimp.com/schema/3.0/CollectionLinks/Reports.json',
‘targetSchema’: 'https://us10.api.mailchimp.com/schema/3.0/Definitions/Reports/CollectionResponse.json'},
{'href': 'https://us10.api.mailchimp.com/3.0/reports/f0219bcf8f',
‘method’: ‘GET’,
‘rel’: ‘self’,
‘targetSchema’: 'https://us10.api.mailchimp.com/schema/3.0/Definitions/Reports/Response.json'},
{'href': 'https://us10.api.mailchimp.com/3.0/campaigns/f0219bcf8f',
‘method’: ‘GET’,
‘rel’: ‘campaign’,
‘targetSchema’: 'https://us10.api.mailchimp.com/schema/3.0/Definitions/Campaigns/Response.json'},
{'href': 'https://us10.api.mailchimp.com/3.0/reports/f0219bcf8f/sub-reports',
‘method’: ‘GET’,
‘rel’: ‘sub-reports’,
‘targetSchema’: 'https://us10.api.mailchimp.com/schema/3.0/Definitions/Reports/Sub/Response.json'},
{'href': 'https://us10.api.mailchimp.com/3.0/reports/f0219bcf8f/abuse-reports',
‘method’: ‘GET’,
‘rel’: ‘abuse-reports’,
‘targetSchema’: 'https://us10.api.mailchimp.com/schema/3.0/Definitions/Reports/Abuse/CollectionResponse.json'},
{'href': 'https://us10.api.mailchimp.com/3.0/reports/f0219bcf8f/advice',
‘method’: ‘GET’,
‘rel’: ‘advice’,
‘targetSchema’: 'https://us10.api.mailchimp.com/schema/3.0/Definitions/Reports/Advice/Response.json'},
{'href': 'https://us10.api.mailchimp.com/3.0/reports/f0219bcf8f/open-details',
‘method’: ‘GET’,
‘rel’: ‘open-details’,
‘targetSchema’: 'https://us10.api.mailchimp.com/schema/3.0/Definitions/Reports/OpenDetails/CollectionResponse.json'},
{'href': 'https://us10.api.mailchimp.com/3.0/reports/f0219bcf8f/click-details',
‘method’: ‘GET’,
‘rel’: ‘click-details’,
‘targetSchema’: 'https://us10.api.mailchimp.com/schema/3.0/Definitions/Reports/ClickDetails/CollectionResponse.json'},
{'href': 'https://us10.api.mailchimp.com/3.0/reports/f0219bcf8f/domain-performance',
‘method’: ‘GET’,
‘rel’: ‘domain-performance’,
‘targetSchema’: 'https://us10.api.mailchimp.com/schema/3.0/Definitions/Reports/DomainPerformance/Response.json'},
{'href': 'https://us10.api.mailchimp.com/3.0/reports/f0219bcf8f/eepurl',
‘method’: ‘GET’,
‘rel’: ‘eepurl’,
‘targetSchema’: 'https://us10.api.mailchimp.com/schema/3.0/Definitions/Reports/Eepurl/CollectionResponse.json'},
{'href': 'https://us10.api.mailchimp.com/3.0/reports/f0219bcf8f/email-activity',
‘method’: ‘GET’,
‘rel’: ‘email-activity’,
‘targetSchema’: 'https://us10.api.mailchimp.com/schema/3.0/Definitions/Reports/EmailActivity/CollectionResponse.json'},
{'href': 'https://us10.api.mailchimp.com/3.0/reports/f0219bcf8f/locations',
‘method’: ‘GET’,
‘rel’: ‘locations’,
‘targetSchema’: 'https://us10.api.mailchimp.com/schema/3.0/Definitions/Reports/Locations/Response.json'},
{'href': 'https://us10.api.mailchimp.com/3.0/reports/f0219bcf8f/sent-to',
‘method’: ‘GET’,
‘rel’: ‘sent-to’,
‘targetSchema’: 'https://us10.api.mailchimp.com/schema/3.0/Definitions/Reports/SentTo/CollectionResponse.json'},
{'href': 'https://us10.api.mailchimp.com/3.0/reports/f0219bcf8f/unsubscribed',
‘method’: ‘GET’,
‘rel’: ‘unsubscribed’,
‘targetSchema’: 'https://us10.api.mailchimp.com/schema/3.0/Definitions/Reports/Unsubs/CollectionResponse.json'}],
'abuse_reports': 0,
'bounces': {'hard_bounces': 4,
'soft_bounces': 23,
'syntax_errors': 0},
'campaign_title': ‘Письмо 3 Знакомство’,
'clicks': {'click_rate': 0.031729055258467,
'clicks_total': 95,
'last_click': ‘2019-06-19T15:20:25+00:00’,
'unique_clicks': 90,
'unique_subscriber_clicks': 89},
‘delivery_status’: {'enabled': False},
‘ecommerce’: {'currency_code': ‘USD’,
‘total_orders’: 0,
‘total_revenue’: 0,
‘total_spent’: 0},
'emails_sent': 2832,
‘facebook_likes’: {'facebook_likes': 0,
‘recipient_likes’: 0,
‘unique_likes’: 0},
'forwards': {'forwards_count': 0,
'forwards_opens': 0},
'id': ‘f0219bcf8f’,
'industry_stats': {'abuse_rate': 0.0001677063473578,
'bounce_rate': 0.0050363758899809,
'click_rate': 0.011997233550586,
'open_rate': 0.11164872575428,
'type': ‘Beauty and ’
‘Personal ’
‘Care’,
'unopen_rate': 0.88331489835574,
'unsub_rate': 0.0021463553764418},
'list_id': ‘e5041a5513’,
'list_is_active': True,
'list_name': ‘[Мастер-класс «Похудение ’
‘без диет»]’,
'list_stats': {'click_rate': 8.3458733649728,
'open_rate': 21.588231914038,
'sub_rate': 153,
'unsub_rate': 112},
'opens': {'last_open': ‘2019-06-19T15:05:48+00:00’,
'open_rate': 0.21390374331551,
'opens_total': 747,
'unique_opens': 600},
'preview_text': '',
'send_time': ‘2019-06-19T15:43:04+00:00’,
'subject_line': ‘Кто я такая и почему ’
‘вам пишу? [Все ответы ’
‘за три минуты]’,
‘timeseries’: [{'emails_sent': 0,
'recipients_clicks': 0,
'timestamp': ‘2019-06-19T15:00:00+00:00’,
'unique_opens': 0}],
'type': ‘automation’,
'unsubscribed': 10}
Офлайн
221
ну почитайте о том как работает словарь. А здесь вложенные друг в друга словари. Принцип одинаковый.
>>> a = { ... "a": { ... "b": { ... "c": 101 ... } ... } ... } >>> a['a'] {'b': {'c': 101}} >>> a['a']['b'] {'c': 101} >>> a['a']['b']['c'] 101 >>> for key, value in a.items(): ... print(key, value) ... a {'b': {'c': 101}}
Офлайн
0
JOHN_16
ну почитайте о том как работает словарь. А здесь вложенные друг в друга словари. Принцип одинаковый.

Офлайн