I have a query in MongoDB using Python:
for car in cars.find({"year": "2014"}):
print car['V8']
The problem is, not every record has V8 entry exists. It will pop up error:
KeyError: 'V8'
No JSON object could be decoded
How can I ignore the error and just print empty string if the Key is not exist?