[{
'original_block': '213.158.64.0/19',
'transferred_blocks': '213.158.64.0/19',
'from': 'REGISTER.IT S.P.A.',
'to': 'REGISTER S.P.A.',
'date': '01/07/2019',
'transferType': 'MERGER_OR_ACQUISITION',
}, {
'original_block': '5.154.240.0/23',
'transferred_blocks': '5.154.240.0/24',
'from': 'NAV COMMUNICATIONS SRL',
'to': 'uPress Inc',
'date': '01/07/2019',
'transferType': 'POLICY',
}, {
'original_block': '78.159.136.0/21',
'transferred_blocks': '78.159.140.0/22',
'from': 'Telecom Aset Ltd',
'to': 'Aryaka Networks Inc.',
'date': '01/07/2019',
'transferType': 'POLICY',
}, {
'original_block': '81.88.48.0/20',
'transferred_blocks': '81.88.48.0/20',
'from': 'REGISTER.IT S.P.A.',
'to': 'REGISTER S.P.A.',
'date': '01/07/2019',
'transferType': 'MERGER_OR_ACQUISITION',
}]
I have a list of IP transfers information that I loaded from a JSON file. I want to extract some values from the JSON file (dictionary) but I keep getting 'list' object has no attribute 'values'.
import json
with open ('iplist.json','r') as t:
d = json.load(t)
address = [item['original_block'] for d_ in d.values() for item in d_]
print(address)
I get
'list' object has no attribute 'values'
I expect to see
address = ['213.158.64.0/19', '5.154.240.0/23', '78.159.136.0/21', '81.88.48.0/20']
address = [item['original_block'] for item in d]