Is it possible to just use .get() function from dictionary for this? Is this the best we can do to shorten this piece of code?
n_dict is a Dict type (uppercase D) and NES is just a list of str
eted_info = {}
for key in n_dict:
if key in NES:
eted_info[key] = n_dict[key]
I'm just curious if there is a better / more pythonic way to retrieve a value, like C# has with TryGetValue.