Steph
@assydcrypto
Tip of the day #21 - Python get the trace ! Do you know that you can get the type and the trace of an exception you caught ? That’s quite useful when you don’t know yet the exact typology of exception you might have to handle. Just like this : import traceback try: something() except Exception as ex: print(‘Exception type=‘ + str(type(ex))) traceback.print_exc() # or traceback.print_exception(*sys.exc_info()) Have fun, stay safe and be nice until next time, cheers ! 🤘🏼🍻 #Python #pythonprogramming
0 reply
0 recast
23 reactions