In the following block of code:
dictionary = dict()
dictionary[0] = {}
try:
print(dictionary[0]["tomato"])
except Exception as e:
print(e) # prints 'tomato'
print(str(e)) # prints 'tomato'
if str(e) == 'tomato':
print("Not tomato") # never prints, why?
Even though print(e) prints 'tomato', str(e) == 'tomato' is not True
Can someone please explain how can this be?