+ 1

What would be possible situations where nesting try/except blocks inside an except block is useful?

Also, is nesting try/except blocks inside a try block a thing?

22nd Mar 2025, 2:45 PM
Igor Matić
Igor Matić - avatar
1 Respuesta
+ 3
Igor Matić , yes, this can be done. the following statements are responses from chatgpt: > Nesting try/except inside an except block Useful when handling an error might itself cause another exception, such as logging failures or fallback operations. > Nesting try/except inside a try block Useful for handling multiple independent errors separately while allowing execution to continue. for each of these statements a sample code was presented. i would recommend you to use chatgpt, so that you can learn and communicate direct and ask additional questions.
22nd Mar 2025, 4:38 PM
Lothar
Lothar - avatar