How to make a dictionary that returns key for keys missing from the dictionary instead of raising KeyError?
How to make a dictionary that returns key for keys missing from the dictionary instead of raising KeyError? Question: I want to create a python dictionary that returns me the key value for the keys are missing from the dictionary. Usage example: dic = smart_dict() dic[‘a’] = ‘one a’ print(dic[‘a’]) # >>> one a print(dic[‘b’]) …
Total answers: 6