'Exit function doesn't work in try except section in python [duplicate]

I put exit function in "except" section in try, except in python but it doesn't work. and 'finally' block still execute. I supposed program should stop after exit() function but it didn't. I will be appreciated it if you tell me why.

# Constants ===============================
List = [1,2,3]

# -----------------------------------------

# Functions ===============================
def main():
  try:
    print(List[4])
    
  except Exception as e:
    print(e)
    exit()
    
  finally:
    print("The 'finally' block.")
    
# -----------------------------------------
if __name__ == '__main__':
  main()
  


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source