'How save specific parts of a dict?

i've a list that looks like this

for i in negocio:   
params = {
    'term': i,
    'fields': 'title',
    'exact_match': 'true'}
response = client.deals.search_deals(params=params)
deal_id.append(response)


deal_id

after deal_id run, i receive back these list.

    [{'success': True,
  'data': {'items': [{'result_score': 1.28568,
     'item': {'id': 151897,
      'type': 'deal',
      'title': 'deal_1',
      'value': None,
      'status': 'open',
      'visible_to': 7,
      'owner': {'id': 13863990},
    
      'person': {'id': 209102,
      
      'organization': None,
      'custom_fields': [],
      'notes': []}}]},
  'additional_data': {'pagination': {'start': 0,
    'limit': 100,
    'more_items_in_collection': False}}},
 {'success': True,
  'data': {'items': [{'result_score': 1.28568,
     'item': {'id': 151898,
      'type': 'deal',
      'title': 'deal_2',
      'value': None,
      'status': 'open',
      'visible_to': 7,
      'owner': {'id': 13863990},
     
      'person': {'id': 331122,

      'organization': None,
      'custom_fields': [],
      'notes': []}}]},
  'additional_data': {'pagination': {'start': 0,
    'limit': 100,
    'more_items_in_collection': False}}}]

How can i keep just the numbers inside these pieces of my list 'item': {'id': 151897}, and 'item': {'id': 151898}

I looked on similar topics but don't found a anwser that could help me



Solution 1:[1]

Save this info in a variable:

x = mylist[0]['key name']

then you can delete that key with:

my_list[0]['key name']

And add a new one. Or generate the same dict without that key. Check this POST

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1