Sometimes you donβt want to put any code in the except part, because you just want to be sure that the code works without errors, but you are not interested in catching them. I could do it like this in C #:
try { do_something() }catch (...) {}
How can I do this in Python ?, because indentation does not allow this:
try: do_something() except: i_must_enter_somecode_here()
By the way, it is possible that what I am doing in C # also does not comply with the principles of error handling. I appreciate it if you have thoughts about it.
python try-except
ehsan88
source share