I'm storing data from an API (that I then store as a pickle) and sometimes there are errors due to missing fields. I'm wondering how I can make it so that it only targets the problematic variable and logs its value as "NULL".
The issue is that I'm storing 6 different variables, so if a single one of them has an issue, all other 5 variables will be skipped. Instead, I want that (or those) problematic variables get replaced by the value "NULL" (or None).
meta = loaded_from_pickle('myData.pickle')
def getAllData():
    data = []
    for i in range(len(meta)):
        try:
            name = meta[i]['base']['name']
            weight = meta[i]['base']['weight']
            height = meta[i]['base']['height']
            age = meta[i]['secondary']['age']
            eye_color = meta[i]['secondary']['eye_color']
            birthday = meta[i]['secondary']['birthday']
            data.append((name, weight, height, age, eye_color, birthday))
        except:
            pass
    return data
print(getAllData())
So what happens is that I end up losing a lot of data points because some data doesn't have "eye_color" or whatnot. So what I should do when there's an "except" should be "make problematic variable = "NULL" ", rather than just passing the entire loop.
 
    