Code
'''
System version : Windows 10 64-bit
Python version : Python 3.6.0 :: Anaconda 4.3.1 (64-bit)
'''
import traceback
try:
print(a)
except Exception as e:
print('simple message:')
print('repr(e):\n',repr(e))
print('-'*45)
print('detail message:')
print('traceback.format_exc():\n',traceback.format_exc())