Here is the above dictionary I need to remove fields like 'timestamp' and field name 'updated_date' inside attributes
How can i do it?
I'm using lot of loops thought that was not a good solution was checking for few code snippets on same to achieve this ?
I'm using python version 2.7 dict:
[{'name': 'mark', 'class': '9thgrade', 'timestamp': '2023-06-05 18:27:23.326', 'reg_no': 651,
'attributes': '{"updated_date": "2023-06-05 18:27:22.543060", "hobbies": "" : " ", "sports": "cricket" : " ",'
' "subjects": {"": u"social", u"chemisty", u"cats": " "}, '
'"address": {"cats": "UK,london"}}'},
{'name': 'mark', 'class': '9thgrade', 'timestamp': '2023-06-05 18:35:32.386', 'reg_no': 661,
'attributes': '{"updated_date": "2023-06-05 18:35:31.609323", "hobbies": "" : " ", "sports": "cricket" : " ", '
'"subjects": {"science,maths"},'
' "address": {"texas,us"}'}]
I did try like below code but the return type is string :
for items2 in db_read:
# result_new=items.pop('attributes')
result_new = items2.get('attributes')
print(type(result_new))
print(result_new)