I have written a function which will return several dictionaries. For example:
def func()
return c # <---- nested dictionary
if __name__ == "__main__":
ans = func()
print ans
If I print the ans:
{u'ok': 1.0, u'result': [{u'price': 129.7, u'_id': datetime.datetime(2015, 2, 23, 9, 32)}, {u'price': 129.78, u'_id': datetime.datetime(2015, 2, 23, 9, 33)},
print ans.get('_id')
If I print this, the result is None.
How can I get _id?
[i['_id'] for i in ans['result']]