Y
yinglcs
I want to keep track of the number of different exception happens in
my python program:
ErrorHash = {}
try:
# come code ...
except Exception, e:
print e
errcode = e
if (ErrorHash.has_key(errcode)):
ErrorFailNo = ErrorHash[errcode]
ErrorHash[errcode] = ErrorFailNo + 1
else:
ErrorHash[errcode] = 1
But when i print out the ErrorHash like this:
print ErrorHash
i get an empty string. Can you please tell me how can I put an
Exception as the key of a hash table ? Or how can i dump out all the
content of the hashtable.
Thank you.
my python program:
ErrorHash = {}
try:
# come code ...
except Exception, e:
print e
errcode = e
if (ErrorHash.has_key(errcode)):
ErrorFailNo = ErrorHash[errcode]
ErrorHash[errcode] = ErrorFailNo + 1
else:
ErrorHash[errcode] = 1
But when i print out the ErrorHash like this:
print ErrorHash
i get an empty string. Can you please tell me how can I put an
Exception as the key of a hash table ? Or how can i dump out all the
content of the hashtable.
Thank you.