How to check the presence of a field in the dictionary?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By DimitriyPS

I load data from a file into a variable of type dictionary. I then assign values from the dictionary to a number of “working” variables. I refer to dictionary fields by standardized names, implying that they are there. However, if the field is not in the dictionary, the program will stop with an error. How to check that the required field is in the dictionary?

:bust_in_silhouette: Reply From: SIsilicon
dictionary.has(field_name) # returns true or false

Thank you, this is what you need.

DimitriyPS | 2018-11-20 19:29