0
Hello, I have the following dictionary.
datas = {'records': [{'createdTime': '2018-02-20T21:56:20.288Z',
'fields': {'publicacao': '2018-01-22'},
'id': 'rec1c1c8qyIkdwyMD'},
{'createdTime': '2018-02-20T21:56:20.288Z',
'fields': {'publicacao': '2018-01-29'},
'id': 'rec2ZzEckjEvtHeL9'},
{'createdTime': '2018-02-20T21:56:50.166Z',
'fields': {'publicacao': '2017-10-16'},
'id': 'rec2qlE8kVgjjJC5I'},
{'createdTime': '2018-02-20T22:17:46.301Z',
'fields': {'publicacao': '2018-02-05'},
'id': 'rec3RXluN3xw8MOf1'},
{'createdTime': '2018-02-20T21:56:50.166Z',
'fields': {'publicacao': '2017-10-23'},
'id': 'rec5H0UvSqLdrGpl5'},
{'createdTime': '2018-02-20T21:56:50.166Z',
'fields': {'publicacao': '2017-11-20'},
'id': 'rec83xBDXZ8Cne8H7'},
{'createdTime': '2018-02-20T21:56:50.166Z',
'fields': {'publicacao': '2017-12-22'},
'id': 'recHhm6vB8TrHGy93'},
{'createdTime': '2018-02-20T21:56:20.288Z',
'fields': {'publicacao': '2018-01-15'},
'id': 'recHmVeJ5nkALuryh'},
{'createdTime': '2018-02-20T21:56:50.166Z',
'fields': {'publicacao': '2017-11-27'},
'id': 'recOajfC1FGtPlmsn'},
{'createdTime': '2018-02-20T21:56:50.166Z',
'fields': {'publicacao': '2017-11-06'},
'id': 'recUNJhuNDYOJ1eaj'},
{'createdTime': '2018-02-20T21:56:50.166Z',
'fields': {'publicacao': '2017-11-13'},
'id': 'recWO44hmzjzhcLfm'},
{'createdTime': '2018-02-20T21:56:50.166Z',
'fields': {'publicacao': '2017-12-19'},
'id': 'recXITnVKRsBPhxCb'},
{'createdTime': '2018-02-20T21:56:50.166Z',
'fields': {'publicacao': '2017-12-11'},
'id': 'rece5u18FUTlCwnC7'},
{'createdTime': '2018-02-20T21:56:50.166Z',
'fields': {'publicacao': '2017-12-04'},
'id': 'receT9LqJ8zFbkbVW'},
{'createdTime': '2018-02-20T21:56:50.166Z',
'fields': {'publicacao': '2017-10-09'},
'id': 'rechssorYxXi8Grdp'},
{'createdTime': '2018-02-20T21:56:50.166Z',
'fields': {'publicacao': '2017-10-30'},
'id': 'recvdSdCxqXz4hbbh'}]}
I wanted to create a list only with the date of Fields. I tried something like this:
base_de_relatorio = []
for v in datas['records']:
base_de_relatorio.append(v['fields'])
The problem is that in this way the name "publishing comes together ({'publishing': '2018-01-22'}). I only need a list of all dates.
Does anyone know how to solve?
Do so:
base_de_relatorio.append(v['fields']['publicacao'])
– NoobSaibot
It worked perfectly! Thank you!
– Cristian Favaro Carriço