Is it possible to ignore exceptions in exception handling?

Asked 1 years ago, Updated 1 years ago, 80 views

I just want to ignore some code and keep running if there's an exception In this case, how should I try-except? See if I'm right

try :
    shutil.rmtree ( path )
except :
    pass

python exception exception-handling try-except

2022-09-22 13:54

1 Answers

There are two ways. The difference between the two methods is written below.

try:
  doSomething()
except: 
  pass

Ina

try:
  doSomething()
except Exception: 
  pass

Please write it with me. The difference between the two methods is


2022-09-22 13:54

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.