There is a dictionary object named my_dic.
my_dic = {'name': 'tom'}
print(f"The name is {my_dic.get('name')}")
In case my_dic is None, there will be an expected exception as 'NoneType' object has no attribute 'get'
.
How to make one line code to get None in case my_dic is None, otherwise return by get().
Thanks.