I have a very large list alist which has a dict and a nested list like this:
a_list = [{'A': [], 's': {'code': '0', 'credits': '0', 'msg': 'OK'}},
{'A': [{'dictionary': 'True',
'item': 'pineapples',
'id': '13',
'score': '9.7899',
'rollup': {'True': 'OK', 'Fiz': 'Yes'},
'variant_list': [{'endp': '8', 'form': 'pineapple', 'register': '0'}]}], 'status': {'codecheck': '0', 'cred': '90809890', 'msg': 'OK'}},
......
{'A': [], 's': {'code': '0', 'credits': '0', 'msg': 'OK'}},
]
How can I extract the extract the item parameter if and only if exist into a list like this:
['NaN', 'pineapples', 'NaN']
I do not understand how to parse it since it has a very nested structure, the main issue which I am struggling with is to accessing to each element of the list and then to the other list and leaving a NaN string.
a_listthey have just an empty list{'A': [], 's': {'code': '0', 'credits': '0', 'msg': 'OK'}}I would like to impute aNaNthere, since it has a void list.{'A': [], 's': {'code': '0', 'credits': '0', 'msg': 'OK'}},forNaN